@@ -94,6 +94,16 @@ describe('git-repo-info', function() {
94
94
commonGitDir : path . join ( testFixturesPath , 'submodule' , 'dot-git' , 'modules' , 'my-submodule' ) ,
95
95
} ) ;
96
96
} ) ;
97
+
98
+ it ( 'finds a repo via submodule on a specific path' , function ( ) {
99
+ process . chdir ( path . join ( testFixturesPath , 'submodule' ) ) ;
100
+
101
+ var foundPathInfo = repoInfo . _findRepo ( 'my-submodule' ) ;
102
+ assert . deepEqual ( foundPathInfo , {
103
+ worktreeGitDir : path . join ( testFixturesPath , 'submodule' , 'dot-git' , 'modules' , 'my-submodule' ) ,
104
+ commonGitDir : path . join ( testFixturesPath , 'submodule' , 'dot-git' , 'modules' , 'my-submodule' ) ,
105
+ } ) ;
106
+ } ) ;
97
107
} ) ;
98
108
99
109
describe ( 'repoInfo' , function ( ) {
@@ -355,6 +365,29 @@ describe('git-repo-info', function() {
355
365
356
366
assert . deepEqual ( result , expected ) ;
357
367
} ) ;
368
+
369
+ it ( 'returns an object for repo info for submodule on a specific path' , function ( ) {
370
+ process . chdir ( path . join ( testFixturesPath , 'submodule' ) ) ;
371
+ var result = repoInfo ( 'my-submodule' ) ;
372
+
373
+ var expected = {
374
+ branch : null ,
375
+ sha : '409372f3bd07c11bfacee3963f48571d675268d7' ,
376
+ abbreviatedSha : '409372f3bd' ,
377
+ tag : null ,
378
+ committer : null ,
379
+ committerDate : null ,
380
+ author : null ,
381
+ authorDate : null ,
382
+ commitMessage : null ,
383
+ // This is a pretty meaningless "root" path. The other information is
384
+ // correct, but we do not have full support for submodules at the
385
+ // moment.
386
+ root : path . join ( testFixturesPath , 'submodule' , 'dot-git' , 'modules' )
387
+ } ;
388
+
389
+ assert . deepEqual ( result , expected ) ;
390
+ } ) ;
358
391
} ) ;
359
392
360
393
describe ( 'repoInfo().root' , function ( ) {
0 commit comments