@matheusbsbs / matheus-bagliano / commits / e5e4a7f23d
Fork 0

builtin-status: Add tests for submodule summary

Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ping Yin committed Apr 12, 2008 at 23:05 UTC e5e4a7f23d7df0ec04b6423a90c9b858082a74af
1 file changed +134
t/t7502-status.sh
+134
@@ -149,4 +149,138 @@ test_expect_success 'status of partial commit excluding new file in index' '
149 test_cmp expect output
150 '
151
152 +test_expect_success 'setup status submodule summary' '
153 + test_create_repo sm && (
154 + cd sm &&
155 + >foo &&
156 + git add foo &&
157 + git commit -m "Add foo"
158 + ) &&
159 + git add sm
160 +'
161 +
162 +cat >expect <<EOF
163 +# On branch master
164 +# Changes to be committed:
165 +# (use "git reset HEAD <file>..." to unstage)
166 +#
167 +# new file: dir2/added
168 +# new file: sm
169 +#
170 +# Changed but not updated:
171 +# (use "git add <file>..." to update what will be committed)
172 +#
173 +# modified: dir1/modified
174 +#
175 +# Untracked files:
176 +# (use "git add <file>..." to include in what will be committed)
177 +#
178 +# dir1/untracked
179 +# dir2/modified
180 +# dir2/untracked
181 +# expect
182 +# output
183 +# untracked
184 +EOF
185 +test_expect_success 'status submodule summary is disabled by default' '
186 + git status >output &&
187 + test_cmp expect output
188 +'
189 +
190 +head=$(cd sm && git rev-parse --short=7 --verify HEAD)
191 +
192 +cat >expect <<EOF
193 +# On branch master
194 +# Changes to be committed:
195 +# (use "git reset HEAD <file>..." to unstage)
196 +#
197 +# new file: dir2/added
198 +# new file: sm
199 +#
200 +# Changed but not updated:
201 +# (use "git add <file>..." to update what will be committed)
202 +#
203 +# modified: dir1/modified
204 +#
205 +# Modified submodules:
206 +#
207 +# * sm 0000000...$head (1):
208 +# > Add foo
209 +#
210 +# Untracked files:
211 +# (use "git add <file>..." to include in what will be committed)
212 +#
213 +# dir1/untracked
214 +# dir2/modified
215 +# dir2/untracked
216 +# expect
217 +# output
218 +# untracked
219 +EOF
220 +test_expect_success 'status submodule summary' '
221 + git config status.submodulesummary 10 &&
222 + git status >output &&
223 + test_cmp expect output
224 +'
225 +
226 +
227 +cat >expect <<EOF
228 +# On branch master
229 +# Changed but not updated:
230 +# (use "git add <file>..." to update what will be committed)
231 +#
232 +# modified: dir1/modified
233 +#
234 +# Untracked files:
235 +# (use "git add <file>..." to include in what will be committed)
236 +#
237 +# dir1/untracked
238 +# dir2/modified
239 +# dir2/untracked
240 +# expect
241 +# output
242 +# untracked
243 +no changes added to commit (use "git add" and/or "git commit -a")
244 +EOF
245 +test_expect_success 'status submodule summary (clean submodule)' '
246 + git commit -m "commit submodule" &&
247 + git config status.submodulesummary 10 &&
248 + test_must_fail git status >output &&
249 + test_cmp expect output
250 +'
251 +
252 +cat >expect <<EOF
253 +# On branch master
254 +# Changes to be committed:
255 +# (use "git reset HEAD^1 <file>..." to unstage)
256 +#
257 +# new file: dir2/added
258 +# new file: sm
259 +#
260 +# Changed but not updated:
261 +# (use "git add <file>..." to update what will be committed)
262 +#
263 +# modified: dir1/modified
264 +#
265 +# Modified submodules:
266 +#
267 +# * sm 0000000...$head (1):
268 +# > Add foo
269 +#
270 +# Untracked files:
271 +# (use "git add <file>..." to include in what will be committed)
272 +#
273 +# dir1/untracked
274 +# dir2/modified
275 +# dir2/untracked
276 +# expect
277 +# output
278 +# untracked
279 +EOF
280 +test_expect_success 'status submodule summary (--amend)' '
281 + git config status.submodulesummary 10 &&
282 + git status --amend >output &&
283 + test_cmp expect output
284 +'
285 +
286 test_done