git ssb

0+

cel / pull-git-remote-helper



Tree: 8d5ec44c46987c16cab1d3060127dd962b120cb5

Files: 8d5ec44c46987c16cab1d3060127dd962b120cb5 / test / repo.js

1189 bytesRaw
1function hexToStr(str) {
2 var buf = new Buffer(str.length / 2)
3 buf.hexWrite(str)
4 return buf.toString('ascii')
5}
6
7var date = '1000000000 -0500'
8
9var user = {
10 name: 'test',
11 email: 'test@localhost'
12}
13user.str = user.name + ' <' + user.email + '>'
14
15var file = {
16 data: new Buffer('i am a file'),
17 hash: '68bd10497ea68e91fa85024d0a0b2fe54e212914'
18}
19var fileName = 'blah.txt'
20
21var tree = {
22 hash: '75c54aa020772a916853987a03bff7079463a861',
23 data: new Buffer([0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x62, 0x6c, 0x61, 0x68, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x68, 0xbd, 0x10, 0x49, 0x7e, 0xa6, 0x8e, 0x91, 0xfa, 0x85, 0x02, 0x4d, 0x0a, 0x0b, 0x2f, 0xe5, 0x4e, 0x21, 0x29, 0x14])
24 // data: '100644 ' + fileName + '\0' + hexToStr(file.hash)
25}
26
27var commitMessage = 'Initial commit'
28var commit = {
29 hash: 'edb5b50e8019797925820007d318870f8c346726',
30 data: new Buffer(['tree ' + tree.hash,
31 'author ' + user.str + ' ' + date,
32 'committer ' + user.str + ' ' + date,
33 '', commitMessage, ''
34 ].join('\n'))
35}
36
37exports.date = date
38exports.user = user
39exports.file = file
40exports.fileName = fileName
41exports.tree = tree
42exports.commitMessage = commitMessage
43exports.commit = commit
44

Built with git-ssb-web