FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/tree.js at v0.1.2 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
21
(21)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
test
/
tree.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (58 loc) · 2.43 KB
Breadcrumbs
nodegit
/
test
/
tree.js
Copy path
File metadata and controls
63 lines (58 loc) · 2.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var
git
=
require
(
'../'
)
,
rimraf
=
require
(
'rimraf'
)
,
fs
=
require
(
'fs'
)
,
path
=
require
(
'path'
)
;
var
sha
=
'5716e9757886eaf38d51c86b192258c960d9cfea'
;
var
fileCount
=
512
;
// Number of blob & blob executabless
exports
.
walk
=
function
(
test
)
{
test
.
expect
(
515
)
;
git
.
Repo
.
open
(
'repos/workdir/.git'
,
function
(
error
,
repo
)
{
repo
.
getCommit
(
sha
,
function
(
error
,
commit
)
{
var
entryCount
=
0
;
commit
.
getTree
(
function
(
error
,
tree
)
{
tree
.
walk
(
)
.
on
(
'entry'
,
function
(
index
,
entry
)
{
test
.
equals
(
error
,
null
,
'There should be no error'
)
;
entryCount
++
;
}
)
.
on
(
'end'
,
function
(
errors
,
entries
)
{
test
.
equals
(
errors
,
null
,
'There should be no error'
)
;
test
.
equals
(
entryCount
,
fileCount
,
'The manual tree entry count and the "end" tree entry count do not match'
)
;
test
.
equals
(
entries
.
length
,
fileCount
,
'The end entries count and the manual entry count do not match'
)
;
test
.
done
(
)
;
}
)
.
start
(
)
;
}
)
;
}
)
;
}
)
;
}
;
exports
.
insert
=
function
(
test
)
{
test
.
expect
(
1
)
;
git
.
Repo
.
open
(
'repos/workdir/.git'
,
function
(
error
,
repo
)
{
repo
.
getCommit
(
sha
,
function
(
error
,
commit
)
{
commit
.
getTree
(
function
(
error
,
tree
)
{
var
text
=
"this is a file\n"
,
buffer
=
new
Buffer
(
text
)
;
repo
.
createBlobFromBuffer
(
buffer
,
function
(
error
,
blobId
)
{
var
builder
=
tree
.
builder
(
)
;
builder
.
insert
(
path
.
join
(
"lib"
,
"baz"
,
"bar.txt"
)
,
blobId
,
git
.
TreeEntry
.
FileMode
.
Blob
)
;
builder
.
write
(
function
(
error
,
treeId
)
{
repo
.
getTree
(
treeId
,
function
(
error
,
tree
)
{
var
author
=
git
.
Signature
.
create
(
"Scott Chacon"
,
"schacon@gmail.com"
,
123456789
,
60
)
,
committer
=
git
.
Signature
.
create
(
"Scott A Chacon"
,
"scott@github.com"
,
987654321
,
90
)
;
repo
.
createCommit
(
null
,
author
,
committer
,
"message"
,
tree
,
[
commit
]
,
function
(
error
,
commitId
)
{
repo
.
getCommit
(
commitId
,
function
(
error
,
commit
)
{
commit
.
getTree
(
function
(
error
,
tree
)
{
tree
.
getEntry
(
'lib/baz/bar.txt'
,
function
(
error
,
entry
)
{
entry
.
getBlob
(
function
(
error
,
blob
)
{
test
.
equals
(
blob
.
toString
(
)
,
text
)
;
test
.
done
(
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL