Files: b57e8b80419ea2fb7cf7d3b5281d371a2b3976c0 / test / repo.js
892 bytesRaw
1 | function hexToStr(str) { |
2 | var buf = new Buffer(str.length / 2) |
3 | buf.hexWrite(str) |
4 | return buf.toString('ascii') |
5 | } |
6 | |
7 | var date = '1000000000 -0500' |
8 | |
9 | var user = { |
10 | name: 'test', |
11 | email: 'test@localhost' |
12 | } |
13 | user.str = user.name + ' <' + user.email + '>' |
14 | |
15 | var file = { |
16 | name: 'blah.txt', |
17 | data: 'i am a file', |
18 | hash: '68bd10497ea68e91fa85024d0a0b2fe54e212914' |
19 | } |
20 | |
21 | var tree = { |
22 | hash: '75c54aa020772a916853987a03bff7079463a861', |
23 | data: '100644 ' + file.name + '\0' + hexToStr(file.hash) |
24 | } |
25 | |
26 | var commitMessage = 'Initial commit' |
27 | var commit = { |
28 | hash: 'edb5b50e8019797925820007d318870f8c346726', |
29 | data: ['tree ' + tree.hash, |
30 | 'author ' + user.str + ' ' + date, |
31 | 'committer ' + user.str + ' ' + date, |
32 | '', commitMessage, '' |
33 | ].join('\n') |
34 | } |
35 | |
36 | exports.date = date |
37 | exports.user = user |
38 | exports.file = file |
39 | exports.tree = tree |
40 | exports.commitMessage = commitMessage |
41 | exports.commit = commit |
42 |
Built with git-ssb-web