@@ -52,6 +52,13 @@ describe('git-repo-info', function() {
52
52
var foundPath = repoInfo . _findRepo ( ) ;
53
53
assert . equal ( foundPath , path . join ( repoRoot , gitDir ) ) ;
54
54
} ) ;
55
+
56
+ it ( 'finds a repo 2 levels up (without an argument)' , function ( ) {
57
+ process . chdir ( path . join ( repoRoot , 'foo' , 'bar' ) ) ;
58
+
59
+ var foundPath = repoInfo . _findRepo ( ) ;
60
+ assert . equal ( foundPath , path . join ( repoRoot , gitDir ) ) ;
61
+ } ) ;
55
62
} ) ;
56
63
57
64
describe ( 'repoInfo' , function ( ) {
@@ -63,7 +70,8 @@ describe('git-repo-info', function() {
63
70
branch : 'master' ,
64
71
sha : '5359aabd3872d9ffd160712e9615c5592dfe6745' ,
65
72
abbreviatedSha : '5359aabd38' ,
66
- tag : null
73
+ tag : null ,
74
+ root : repoRoot
67
75
} ;
68
76
69
77
assert . deepEqual ( result , expected ) ;
@@ -77,7 +85,8 @@ describe('git-repo-info', function() {
77
85
branch : null ,
78
86
sha : '9dac893d5a83c02344d91e79dad8904889aeacb1' ,
79
87
abbreviatedSha : '9dac893d5a' ,
80
- tag : null
88
+ tag : null ,
89
+ root : repoRoot
81
90
} ;
82
91
83
92
assert . deepEqual ( result , expected ) ;
@@ -92,7 +101,8 @@ describe('git-repo-info', function() {
92
101
branch : 'master' ,
93
102
sha : '5359aabd3872d9ffd160712e9615c5592dfe6745' ,
94
103
abbreviatedSha : '5359aabd38' ,
95
- tag : 'my-tag'
104
+ tag : 'my-tag' ,
105
+ root : repoRoot
96
106
} ;
97
107
98
108
assert . deepEqual ( result , expected ) ;
@@ -106,7 +116,8 @@ describe('git-repo-info', function() {
106
116
branch : 'master' ,
107
117
sha : 'c1ee41c325d54f410b133e0018c7a6b1316f6cda' ,
108
118
abbreviatedSha : 'c1ee41c325' ,
109
- tag : 'awesome-tag'
119
+ tag : 'awesome-tag' ,
120
+ root : repoRoot
110
121
} ;
111
122
112
123
assert . deepEqual ( result , expected ) ;
@@ -120,7 +131,8 @@ describe('git-repo-info', function() {
120
131
branch : 'master' ,
121
132
sha : 'c1ee41c325d54f410b133e0018c7a6b1316f6cda' ,
122
133
abbreviatedSha : 'c1ee41c325' ,
123
- tag : 'awesome-tag'
134
+ tag : 'awesome-tag' ,
135
+ root : repoRoot
124
136
} ;
125
137
126
138
assert . deepEqual ( result , expected ) ;
@@ -135,7 +147,8 @@ describe('git-repo-info', function() {
135
147
branch : 'master' ,
136
148
sha : 'c1ee41c325d54f410b133e0018c7a6b1316f6cda' ,
137
149
abbreviatedSha : 'c1ee41c325' ,
138
- tag : 'awesome-tag'
150
+ tag : 'awesome-tag' ,
151
+ root : repoRoot
139
152
} ;
140
153
141
154
assert . deepEqual ( result , expected ) ;
@@ -150,10 +163,25 @@ describe('git-repo-info', function() {
150
163
branch : 'feature/branch/with/slashes' ,
151
164
sha : '5359aabd3872d9ffd160712e9615c5592dfe6745' ,
152
165
abbreviatedSha : '5359aabd38' ,
153
- tag : null
166
+ tag : null ,
167
+ root : repoRoot
154
168
} ;
155
169
156
170
assert . deepEqual ( result , expected ) ;
157
171
} ) ;
158
172
} ) ;
173
+
174
+ describe ( 'repoInfo().root' , function ( ) {
175
+ var repoRoot = path . join ( testFixturesPath , 'nested-repo' ) ;
176
+
177
+ it ( 'finds a repo from cwd (2 levels up)' , function ( ) {
178
+ process . chdir ( path . join ( repoRoot , 'foo' , 'bar' ) ) ;
179
+ assert . equal ( repoInfo ( ) . root , repoRoot ) ;
180
+ } ) ;
181
+
182
+ it ( 'finds a repo with an argument' , function ( ) {
183
+ assert . equal ( repoInfo ( path . join ( repoRoot , 'foo' , 'bar' ) ) . root , repoRoot ) ;
184
+ } ) ;
185
+
186
+ } ) ;
159
187
} ) ;
0 commit comments