File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ var nodegit = require ( '../' ) ;
2
+ var path = require ( 'path' ) ;
3
+
4
+ /**
5
+ * This shows how to get details from a tree entry or a blob
6
+ **/
7
+
8
+ nodegit . Repository . open ( path . resolve ( __dirname , '../.git' ) )
9
+ . then ( function ( repo ) {
10
+ return repo . getTree (
11
+ nodegit . Oid . fromString ( "e1b0c7ea57bfc5e30ec279402a98168a27838ac9" ) )
12
+ . then ( function ( tree ) {
13
+ var treeEntry = tree . entryByIndex ( 0 ) ;
14
+
15
+ // Tree entry doesn't have any data associated with the actual entry
16
+ // To get that we need to get the index entry that this points to
17
+ return repo . openIndex ( ) . then ( function ( index ) {
18
+ var indexEntry = index . getByPath ( treeEntry . path ( ) ) ;
19
+
20
+ // With the index entry we can now view the details for the tree entry
21
+ console . log ( "Entry path: " + indexEntry . path ( ) ) ;
22
+ console . log ( "Entry time in seconds: " + indexEntry . mtime ( ) . seconds ( ) ) ;
23
+ console . log ( "Entry oid: " + indexEntry . id ( ) . toString ( ) ) ;
24
+ console . log ( "Entry size: " + indexEntry . fileSize ( ) ) ;
25
+ } ) ;
26
+ } )
27
+ } ) . done ( function ( ) {
28
+ console . log ( "Done!" ) ;
29
+ } ) ;
Original file line number Diff line number Diff line change 601
601
"git_index_free" : {
602
602
"ignore" : true
603
603
},
604
+ "git_index_get_bypath" : {
605
+ "args" : {
606
+ "stage" : {
607
+ "isOptional" : true
608
+ }
609
+ }
610
+ },
604
611
"git_index_new" : {
605
612
"ignore" : true
606
613
},
You can’t perform that action at this time.
0 commit comments