File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 24992499 "jsFunctionName" : " _entryByIndex"
25002500 },
25012501 "git_tree_entry_byname" : {
2502- "return" : {
2503- "ownedByThis" : true
2504- }
2502+ "jsFunctionName" : " _entryByName"
25052503 },
25062504 "git_tree_entrycount" : {
25072505 "jsFunctionName" : " entryCount"
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ Tree.prototype.entryByIndex = function(i) {
6565 * @return {TreeEntry }
6666 */
6767Tree . prototype . entryByName = function ( name ) {
68- var entry = this . entryByName ( name ) ;
68+ var entry = this . _entryByName ( name ) ;
6969 entry . parent = this ;
7070 return entry ;
7171} ;
Original file line number Diff line number Diff line change @@ -5,22 +5,40 @@ var promisify = require("promisify-node");
55var fse = promisify ( require ( "fs-extra" ) ) ;
66
77describe ( "Tree" , function ( ) {
8+ var NodeGit = require ( "../../" ) ;
89 var RepoUtils = require ( "../utils/repository_setup" ) ;
910
1011 var repoPath = local ( "../repos/tree" ) ;
12+ var existingPath = local ( "../repos/workdir" ) ;
13+ var oid = "5716e9757886eaf38d51c86b192258c960d9cfea" ;
1114
1215 beforeEach ( function ( ) {
1316 var test = this ;
1417 return RepoUtils . createRepository ( repoPath )
1518 . then ( function ( repo ) {
1619 test . repository = repo ;
20+ } ) . then ( function ( ) {
21+ return NodeGit . Repository . open ( existingPath ) ;
22+ } ) . then ( function ( repository ) {
23+ test . existingRepo = repository ;
24+ return repository . getCommit ( oid ) ;
25+ } ) . then ( function ( commit ) {
26+ test . commit = commit ;
1727 } ) ;
1828 } ) ;
1929
2030 after ( function ( ) {
2131 return fse . remove ( repoPath ) ;
2232 } ) ;
2333
34+ it ( "gets an entry by name" ,
35+ function ( done ) {
36+ this . commit . getTree ( ) . then ( function ( tree ) {
37+ var entry = tree . entryByName ( "README.md" ) ;
38+ assert ( entry ) ;
39+ } ) . done ( done ) ;
40+ } ) ;
41+
2442 it ( "walks its entries and returns the same entries on both progress and end" ,
2543 function ( ) {
2644 var repo = this . repository ;
You can’t perform that action at this time.
0 commit comments