]>
Commit | Line | Data |
---|---|---|
367c9886 JS |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Johannes E. Schindelin | |
4 | # | |
5 | ||
47a528ad | 6 | test_description='git status' |
367c9886 JS |
7 | |
8 | . ./test-lib.sh | |
9 | ||
5d3dd915 | 10 | test_expect_success 'status -h in broken repository' ' |
6a38ef2c | 11 | git config --global advice.statusuoption false && |
5d3dd915 NTND |
12 | mkdir broken && |
13 | test_when_finished "rm -fr broken" && | |
14 | ( | |
15 | cd broken && | |
16 | git init && | |
17 | echo "[status] showuntrackedfiles = CORRUPT" >>.git/config && | |
18 | test_expect_code 129 git status -h >usage 2>&1 | |
19 | ) && | |
cc6658e7 | 20 | test_i18ngrep "[Uu]sage" broken/usage |
5d3dd915 NTND |
21 | ' |
22 | ||
23 | test_expect_success 'commit -h in broken repository' ' | |
24 | mkdir broken && | |
25 | test_when_finished "rm -fr broken" && | |
26 | ( | |
27 | cd broken && | |
28 | git init && | |
29 | echo "[status] showuntrackedfiles = CORRUPT" >>.git/config && | |
30 | test_expect_code 129 git commit -h >usage 2>&1 | |
31 | ) && | |
cc6658e7 | 32 | test_i18ngrep "[Uu]sage" broken/usage |
5d3dd915 NTND |
33 | ' |
34 | ||
75177c85 JK |
35 | test_expect_success 'create upstream branch' ' |
36 | git checkout -b upstream && | |
37 | test_commit upstream1 && | |
38 | test_commit upstream2 && | |
39 | # leave the first commit on master as root because several | |
40 | # tests depend on this case; for our upstream we only | |
41 | # care about commit counts anyway, so a totally divergent | |
42 | # history is OK | |
43 | git checkout --orphan master | |
44 | ' | |
45 | ||
367c9886 | 46 | test_expect_success 'setup' ' |
68cfc6f5 MG |
47 | : >tracked && |
48 | : >modified && | |
367c9886 | 49 | mkdir dir1 && |
68cfc6f5 MG |
50 | : >dir1/tracked && |
51 | : >dir1/modified && | |
367c9886 | 52 | mkdir dir2 && |
68cfc6f5 MG |
53 | : >dir1/tracked && |
54 | : >dir1/modified && | |
367c9886 | 55 | git add . && |
ff58b9aa JK |
56 | |
57 | git status >output && | |
58 | ||
367c9886 JS |
59 | test_tick && |
60 | git commit -m initial && | |
68cfc6f5 MG |
61 | : >untracked && |
62 | : >dir1/untracked && | |
63 | : >dir2/untracked && | |
64 | echo 1 >dir1/modified && | |
65 | echo 2 >dir2/modified && | |
66 | echo 3 >dir2/added && | |
75177c85 JK |
67 | git add dir2/added && |
68 | ||
69 | git branch --set-upstream-to=upstream | |
367c9886 JS |
70 | ' |
71 | ||
cc6658e7 JH |
72 | test_expect_success 'status (1)' ' |
73 | test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output | |
ff58b9aa JK |
74 | ' |
75 | ||
2556b996 | 76 | strip_comments () { |
2e582df0 ES |
77 | tab=' ' |
78 | sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp && | |
2556b996 MM |
79 | rm "$1" && mv "$1".tmp "$1" |
80 | } | |
81 | ||
ec8a896e JH |
82 | cat >.gitignore <<\EOF |
83 | .gitignore | |
84 | expect* | |
85 | output* | |
86 | EOF | |
87 | ||
323d0530 | 88 | test_expect_success 'status --column' ' |
323d0530 NTND |
89 | cat >expect <<\EOF && |
90 | # On branch master | |
75177c85 JK |
91 | # Your branch and '\''upstream'\'' have diverged, |
92 | # and have 1 and 2 different commits each, respectively. | |
93 | # (use "git pull" to merge the remote branch into yours) | |
94 | # | |
323d0530 NTND |
95 | # Changes to be committed: |
96 | # (use "git reset HEAD <file>..." to unstage) | |
97 | # | |
98 | # new file: dir2/added | |
99 | # | |
100 | # Changes not staged for commit: | |
101 | # (use "git add <file>..." to update what will be committed) | |
102 | # (use "git checkout -- <file>..." to discard changes in working directory) | |
103 | # | |
104 | # modified: dir1/modified | |
105 | # | |
106 | # Untracked files: | |
107 | # (use "git add <file>..." to include in what will be committed) | |
108 | # | |
ec8a896e JH |
109 | # dir1/untracked dir2/untracked |
110 | # dir2/modified untracked | |
2f0f7f1c | 111 | # |
323d0530 | 112 | EOF |
2556b996 MM |
113 | COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output && |
114 | test_i18ncmp expect output | |
115 | ' | |
116 | ||
117 | test_expect_success 'status --column status.displayCommentPrefix=false' ' | |
118 | strip_comments expect && | |
119 | COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output && | |
b354f11b | 120 | test_i18ncmp expect output |
323d0530 NTND |
121 | ' |
122 | ||
68cfc6f5 | 123 | cat >expect <<\EOF |
367c9886 | 124 | # On branch master |
75177c85 JK |
125 | # Your branch and 'upstream' have diverged, |
126 | # and have 1 and 2 different commits each, respectively. | |
127 | # (use "git pull" to merge the remote branch into yours) | |
128 | # | |
367c9886 JS |
129 | # Changes to be committed: |
130 | # (use "git reset HEAD <file>..." to unstage) | |
131 | # | |
132 | # new file: dir2/added | |
133 | # | |
8009d83c | 134 | # Changes not staged for commit: |
367c9886 | 135 | # (use "git add <file>..." to update what will be committed) |
4d6e4c4d | 136 | # (use "git checkout -- <file>..." to discard changes in working directory) |
367c9886 JS |
137 | # |
138 | # modified: dir1/modified | |
139 | # | |
140 | # Untracked files: | |
141 | # (use "git add <file>..." to include in what will be committed) | |
142 | # | |
143 | # dir1/untracked | |
144 | # dir2/modified | |
145 | # dir2/untracked | |
367c9886 | 146 | # untracked |
2f0f7f1c | 147 | # |
367c9886 JS |
148 | EOF |
149 | ||
2556b996 MM |
150 | test_expect_success 'status with status.displayCommentPrefix=true' ' |
151 | git -c status.displayCommentPrefix=true status >output && | |
152 | test_i18ncmp expect output | |
153 | ' | |
154 | ||
155 | test_expect_success 'status with status.displayCommentPrefix=false' ' | |
156 | strip_comments expect && | |
157 | git -c status.displayCommentPrefix=false status >output && | |
cc6658e7 | 158 | test_i18ncmp expect output |
367c9886 JS |
159 | ' |
160 | ||
f8c65c1f MG |
161 | test_expect_success 'status -v' ' |
162 | (cat expect && git diff --cached) >expect-with-v && | |
163 | git status -v >output && | |
164 | test_i18ncmp expect-with-v output | |
165 | ' | |
166 | ||
40555000 MG |
167 | test_expect_success 'status -v -v' ' |
168 | (cat expect && | |
169 | echo "Changes to be committed:" && | |
170 | git -c diff.mnemonicprefix=true diff --cached && | |
171 | echo "--------------------------------------------------" && | |
172 | echo "Changes not staged for commit:" && | |
173 | git -c diff.mnemonicprefix=true diff) >expect-with-v && | |
174 | git status -v -v >output && | |
175 | test_i18ncmp expect-with-v output | |
176 | ' | |
177 | ||
2556b996 MM |
178 | test_expect_success 'setup fake editor' ' |
179 | cat >.git/editor <<-\EOF && | |
180 | #! /bin/sh | |
181 | cp "$1" output | |
182 | EOF | |
183 | chmod 755 .git/editor | |
184 | ' | |
185 | ||
186 | commit_template_commented () { | |
187 | ( | |
188 | EDITOR=.git/editor && | |
189 | export EDITOR && | |
190 | # Fails due to empty message | |
191 | test_must_fail git commit | |
192 | ) && | |
193 | ! grep '^[^#]' output | |
194 | } | |
195 | ||
196 | test_expect_success 'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' ' | |
197 | commit_template_commented | |
198 | ' | |
199 | ||
18f3b5a9 | 200 | cat >expect <<\EOF |
1c7969c9 | 201 | On branch master |
75177c85 JK |
202 | Your branch and 'upstream' have diverged, |
203 | and have 1 and 2 different commits each, respectively. | |
204 | ||
1c7969c9 MM |
205 | Changes to be committed: |
206 | new file: dir2/added | |
207 | ||
208 | Changes not staged for commit: | |
209 | modified: dir1/modified | |
210 | ||
211 | Untracked files: | |
212 | dir1/untracked | |
213 | dir2/modified | |
214 | dir2/untracked | |
1c7969c9 | 215 | untracked |
2f0f7f1c | 216 | |
18f3b5a9 MG |
217 | EOF |
218 | ||
cc6658e7 | 219 | test_expect_success 'status (advice.statusHints false)' ' |
c63659dd | 220 | test_config advice.statusHints false && |
18f3b5a9 | 221 | git status >output && |
cc6658e7 | 222 | test_i18ncmp expect output |
18f3b5a9 MG |
223 | |
224 | ' | |
225 | ||
68cfc6f5 | 226 | cat >expect <<\EOF |
14ed05dd MG |
227 | M dir1/modified |
228 | A dir2/added | |
229 | ?? dir1/untracked | |
230 | ?? dir2/modified | |
231 | ?? dir2/untracked | |
14ed05dd MG |
232 | ?? untracked |
233 | EOF | |
234 | ||
46077fa5 | 235 | test_expect_success 'status -s' ' |
14ed05dd | 236 | |
68cfc6f5 | 237 | git status -s >output && |
14ed05dd MG |
238 | test_cmp expect output |
239 | ||
240 | ' | |
241 | ||
150b493a JH |
242 | test_expect_success 'status with gitignore' ' |
243 | { | |
244 | echo ".gitignore" && | |
f8c65c1f | 245 | echo "expect*" && |
150b493a JH |
246 | echo "output" && |
247 | echo "untracked" | |
248 | } >.gitignore && | |
249 | ||
250 | cat >expect <<-\EOF && | |
251 | M dir1/modified | |
252 | A dir2/added | |
253 | ?? dir2/modified | |
254 | EOF | |
255 | git status -s >output && | |
256 | test_cmp expect output && | |
257 | ||
258 | cat >expect <<-\EOF && | |
259 | M dir1/modified | |
260 | A dir2/added | |
261 | ?? dir2/modified | |
262 | !! .gitignore | |
263 | !! dir1/untracked | |
264 | !! dir2/untracked | |
265 | !! expect | |
f8c65c1f | 266 | !! expect-with-v |
150b493a JH |
267 | !! output |
268 | !! untracked | |
269 | EOF | |
270 | git status -s --ignored >output && | |
271 | test_cmp expect output && | |
272 | ||
1c7969c9 MM |
273 | cat >expect <<\EOF && |
274 | On branch master | |
75177c85 JK |
275 | Your branch and '\''upstream'\'' have diverged, |
276 | and have 1 and 2 different commits each, respectively. | |
277 | (use "git pull" to merge the remote branch into yours) | |
278 | ||
1c7969c9 MM |
279 | Changes to be committed: |
280 | (use "git reset HEAD <file>..." to unstage) | |
281 | ||
282 | new file: dir2/added | |
283 | ||
284 | Changes not staged for commit: | |
285 | (use "git add <file>..." to update what will be committed) | |
286 | (use "git checkout -- <file>..." to discard changes in working directory) | |
287 | ||
288 | modified: dir1/modified | |
289 | ||
290 | Untracked files: | |
291 | (use "git add <file>..." to include in what will be committed) | |
292 | ||
293 | dir2/modified | |
2f0f7f1c | 294 | |
1c7969c9 MM |
295 | Ignored files: |
296 | (use "git add -f <file>..." to include in what will be committed) | |
297 | ||
298 | .gitignore | |
299 | dir1/untracked | |
300 | dir2/untracked | |
301 | expect | |
f8c65c1f | 302 | expect-with-v |
1c7969c9 MM |
303 | output |
304 | untracked | |
2f0f7f1c | 305 | |
1c7969c9 | 306 | EOF |
150b493a | 307 | git status --ignored >output && |
ca0f515d | 308 | test_i18ncmp expect output |
150b493a JH |
309 | ' |
310 | ||
311 | test_expect_success 'status with gitignore (nothing untracked)' ' | |
312 | { | |
313 | echo ".gitignore" && | |
f8c65c1f | 314 | echo "expect*" && |
150b493a JH |
315 | echo "dir2/modified" && |
316 | echo "output" && | |
317 | echo "untracked" | |
318 | } >.gitignore && | |
319 | ||
320 | cat >expect <<-\EOF && | |
321 | M dir1/modified | |
322 | A dir2/added | |
323 | EOF | |
324 | git status -s >output && | |
325 | test_cmp expect output && | |
326 | ||
327 | cat >expect <<-\EOF && | |
328 | M dir1/modified | |
329 | A dir2/added | |
330 | !! .gitignore | |
331 | !! dir1/untracked | |
332 | !! dir2/modified | |
333 | !! dir2/untracked | |
334 | !! expect | |
f8c65c1f | 335 | !! expect-with-v |
150b493a JH |
336 | !! output |
337 | !! untracked | |
338 | EOF | |
339 | git status -s --ignored >output && | |
340 | test_cmp expect output && | |
341 | ||
1c7969c9 MM |
342 | cat >expect <<\EOF && |
343 | On branch master | |
75177c85 JK |
344 | Your branch and '\''upstream'\'' have diverged, |
345 | and have 1 and 2 different commits each, respectively. | |
346 | (use "git pull" to merge the remote branch into yours) | |
347 | ||
1c7969c9 MM |
348 | Changes to be committed: |
349 | (use "git reset HEAD <file>..." to unstage) | |
350 | ||
351 | new file: dir2/added | |
352 | ||
353 | Changes not staged for commit: | |
354 | (use "git add <file>..." to update what will be committed) | |
355 | (use "git checkout -- <file>..." to discard changes in working directory) | |
356 | ||
357 | modified: dir1/modified | |
358 | ||
359 | Ignored files: | |
360 | (use "git add -f <file>..." to include in what will be committed) | |
361 | ||
362 | .gitignore | |
363 | dir1/untracked | |
364 | dir2/modified | |
365 | dir2/untracked | |
366 | expect | |
f8c65c1f | 367 | expect-with-v |
1c7969c9 MM |
368 | output |
369 | untracked | |
2f0f7f1c | 370 | |
1c7969c9 | 371 | EOF |
150b493a | 372 | git status --ignored >output && |
ca0f515d | 373 | test_i18ncmp expect output |
150b493a JH |
374 | ' |
375 | ||
ec8a896e JH |
376 | cat >.gitignore <<\EOF |
377 | .gitignore | |
378 | expect* | |
379 | output* | |
380 | EOF | |
150b493a | 381 | |
46077fa5 | 382 | cat >expect <<\EOF |
75177c85 | 383 | ## master...upstream [ahead 1, behind 2] |
46077fa5 MG |
384 | M dir1/modified |
385 | A dir2/added | |
386 | ?? dir1/untracked | |
387 | ?? dir2/modified | |
388 | ?? dir2/untracked | |
46077fa5 MG |
389 | ?? untracked |
390 | EOF | |
391 | ||
392 | test_expect_success 'status -s -b' ' | |
393 | ||
394 | git status -s -b >output && | |
0d75bfe6 | 395 | test_i18ncmp expect output |
46077fa5 MG |
396 | |
397 | ' | |
398 | ||
a5985237 JK |
399 | test_expect_success 'status -s -z -b' ' |
400 | tr "\\n" Q <expect >expect.q && | |
401 | mv expect.q expect && | |
402 | git status -s -z -b >output && | |
403 | nul_to_q <output >output.q && | |
404 | mv output.q output && | |
0d75bfe6 | 405 | test_i18ncmp expect output |
a5985237 JK |
406 | ' |
407 | ||
355ec7a1 ÆAB |
408 | test_expect_success 'setup dir3' ' |
409 | mkdir dir3 && | |
410 | : >dir3/untracked1 && | |
411 | : >dir3/untracked2 | |
412 | ' | |
413 | ||
cc6658e7 | 414 | test_expect_success 'status -uno' ' |
1c7969c9 MM |
415 | cat >expect <<EOF && |
416 | On branch master | |
75177c85 JK |
417 | Your branch and '\''upstream'\'' have diverged, |
418 | and have 1 and 2 different commits each, respectively. | |
419 | (use "git pull" to merge the remote branch into yours) | |
420 | ||
1c7969c9 MM |
421 | Changes to be committed: |
422 | (use "git reset HEAD <file>..." to unstage) | |
423 | ||
424 | new file: dir2/added | |
425 | ||
426 | Changes not staged for commit: | |
427 | (use "git add <file>..." to update what will be committed) | |
428 | (use "git checkout -- <file>..." to discard changes in working directory) | |
429 | ||
430 | modified: dir1/modified | |
431 | ||
432 | Untracked files not listed (use -u option to show untracked files) | |
433 | EOF | |
6c2ce048 | 434 | git status -uno >output && |
cc6658e7 | 435 | test_i18ncmp expect output |
6c2ce048 MSO |
436 | ' |
437 | ||
cc6658e7 | 438 | test_expect_success 'status (status.showUntrackedFiles no)' ' |
c63659dd | 439 | test_config status.showuntrackedfiles no && |
d6293d1f | 440 | git status >output && |
cc6658e7 | 441 | test_i18ncmp expect output |
d6293d1f MSO |
442 | ' |
443 | ||
cc6658e7 | 444 | test_expect_success 'status -uno (advice.statusHints false)' ' |
1c7969c9 MM |
445 | cat >expect <<EOF && |
446 | On branch master | |
75177c85 JK |
447 | Your branch and '\''upstream'\'' have diverged, |
448 | and have 1 and 2 different commits each, respectively. | |
449 | ||
1c7969c9 MM |
450 | Changes to be committed: |
451 | new file: dir2/added | |
452 | ||
453 | Changes not staged for commit: | |
454 | modified: dir1/modified | |
455 | ||
456 | Untracked files not listed | |
457 | EOF | |
c63659dd | 458 | test_config advice.statusHints false && |
18f3b5a9 | 459 | git status -uno >output && |
cc6658e7 | 460 | test_i18ncmp expect output |
18f3b5a9 | 461 | ' |
18f3b5a9 | 462 | |
14ed05dd MG |
463 | cat >expect << EOF |
464 | M dir1/modified | |
465 | A dir2/added | |
466 | EOF | |
467 | test_expect_success 'status -s -uno' ' | |
14ed05dd MG |
468 | git status -s -uno >output && |
469 | test_cmp expect output | |
470 | ' | |
471 | ||
472 | test_expect_success 'status -s (status.showUntrackedFiles no)' ' | |
99094a7a | 473 | git config status.showuntrackedfiles no && |
14ed05dd MG |
474 | git status -s >output && |
475 | test_cmp expect output | |
476 | ' | |
477 | ||
cc6658e7 | 478 | test_expect_success 'status -unormal' ' |
1c7969c9 MM |
479 | cat >expect <<EOF && |
480 | On branch master | |
75177c85 JK |
481 | Your branch and '\''upstream'\'' have diverged, |
482 | and have 1 and 2 different commits each, respectively. | |
483 | (use "git pull" to merge the remote branch into yours) | |
484 | ||
1c7969c9 MM |
485 | Changes to be committed: |
486 | (use "git reset HEAD <file>..." to unstage) | |
487 | ||
488 | new file: dir2/added | |
489 | ||
490 | Changes not staged for commit: | |
491 | (use "git add <file>..." to update what will be committed) | |
492 | (use "git checkout -- <file>..." to discard changes in working directory) | |
493 | ||
494 | modified: dir1/modified | |
495 | ||
496 | Untracked files: | |
497 | (use "git add <file>..." to include in what will be committed) | |
498 | ||
499 | dir1/untracked | |
500 | dir2/modified | |
501 | dir2/untracked | |
502 | dir3/ | |
1c7969c9 | 503 | untracked |
2f0f7f1c | 504 | |
1c7969c9 | 505 | EOF |
4bfee30a | 506 | git status -unormal >output && |
cc6658e7 | 507 | test_i18ncmp expect output |
4bfee30a MSO |
508 | ' |
509 | ||
cc6658e7 | 510 | test_expect_success 'status (status.showUntrackedFiles normal)' ' |
99094a7a | 511 | test_config status.showuntrackedfiles normal && |
d6293d1f | 512 | git status >output && |
cc6658e7 | 513 | test_i18ncmp expect output |
d6293d1f MSO |
514 | ' |
515 | ||
14ed05dd MG |
516 | cat >expect <<EOF |
517 | M dir1/modified | |
518 | A dir2/added | |
519 | ?? dir1/untracked | |
520 | ?? dir2/modified | |
521 | ?? dir2/untracked | |
522 | ?? dir3/ | |
14ed05dd MG |
523 | ?? untracked |
524 | EOF | |
525 | test_expect_success 'status -s -unormal' ' | |
14ed05dd MG |
526 | git status -s -unormal >output && |
527 | test_cmp expect output | |
528 | ' | |
529 | ||
530 | test_expect_success 'status -s (status.showUntrackedFiles normal)' ' | |
99094a7a | 531 | git config status.showuntrackedfiles normal && |
14ed05dd MG |
532 | git status -s >output && |
533 | test_cmp expect output | |
534 | ' | |
535 | ||
cc6658e7 | 536 | test_expect_success 'status -uall' ' |
1c7969c9 MM |
537 | cat >expect <<EOF && |
538 | On branch master | |
75177c85 JK |
539 | Your branch and '\''upstream'\'' have diverged, |
540 | and have 1 and 2 different commits each, respectively. | |
541 | (use "git pull" to merge the remote branch into yours) | |
542 | ||
1c7969c9 MM |
543 | Changes to be committed: |
544 | (use "git reset HEAD <file>..." to unstage) | |
545 | ||
546 | new file: dir2/added | |
547 | ||
548 | Changes not staged for commit: | |
549 | (use "git add <file>..." to update what will be committed) | |
550 | (use "git checkout -- <file>..." to discard changes in working directory) | |
551 | ||
552 | modified: dir1/modified | |
553 | ||
554 | Untracked files: | |
555 | (use "git add <file>..." to include in what will be committed) | |
556 | ||
557 | dir1/untracked | |
558 | dir2/modified | |
559 | dir2/untracked | |
560 | dir3/untracked1 | |
561 | dir3/untracked2 | |
1c7969c9 | 562 | untracked |
2f0f7f1c | 563 | |
1c7969c9 | 564 | EOF |
4bfee30a | 565 | git status -uall >output && |
cc6658e7 | 566 | test_i18ncmp expect output |
d6293d1f | 567 | ' |
cc6658e7 JH |
568 | |
569 | test_expect_success 'status (status.showUntrackedFiles all)' ' | |
99094a7a | 570 | test_config status.showuntrackedfiles all && |
d6293d1f | 571 | git status >output && |
cc6658e7 | 572 | test_i18ncmp expect output |
4bfee30a MSO |
573 | ' |
574 | ||
355ec7a1 ÆAB |
575 | test_expect_success 'teardown dir3' ' |
576 | rm -rf dir3 | |
577 | ' | |
578 | ||
14ed05dd MG |
579 | cat >expect <<EOF |
580 | M dir1/modified | |
581 | A dir2/added | |
582 | ?? dir1/untracked | |
583 | ?? dir2/modified | |
584 | ?? dir2/untracked | |
14ed05dd MG |
585 | ?? untracked |
586 | EOF | |
587 | test_expect_success 'status -s -uall' ' | |
a6a4a88a | 588 | test_unconfig status.showuntrackedfiles && |
14ed05dd MG |
589 | git status -s -uall >output && |
590 | test_cmp expect output | |
591 | ' | |
592 | test_expect_success 'status -s (status.showUntrackedFiles all)' ' | |
c63659dd | 593 | test_config status.showuntrackedfiles all && |
14ed05dd MG |
594 | git status -s >output && |
595 | rm -rf dir3 && | |
14ed05dd MG |
596 | test_cmp expect output |
597 | ' | |
598 | ||
cc6658e7 | 599 | test_expect_success 'status with relative paths' ' |
1c7969c9 MM |
600 | cat >expect <<\EOF && |
601 | On branch master | |
75177c85 JK |
602 | Your branch and '\''upstream'\'' have diverged, |
603 | and have 1 and 2 different commits each, respectively. | |
604 | (use "git pull" to merge the remote branch into yours) | |
605 | ||
1c7969c9 MM |
606 | Changes to be committed: |
607 | (use "git reset HEAD <file>..." to unstage) | |
608 | ||
609 | new file: ../dir2/added | |
610 | ||
611 | Changes not staged for commit: | |
612 | (use "git add <file>..." to update what will be committed) | |
613 | (use "git checkout -- <file>..." to discard changes in working directory) | |
614 | ||
615 | modified: modified | |
616 | ||
617 | Untracked files: | |
618 | (use "git add <file>..." to include in what will be committed) | |
619 | ||
620 | untracked | |
621 | ../dir2/modified | |
622 | ../dir2/untracked | |
1c7969c9 | 623 | ../untracked |
2f0f7f1c | 624 | |
1c7969c9 | 625 | EOF |
68cfc6f5 | 626 | (cd dir1 && git status) >output && |
cc6658e7 | 627 | test_i18ncmp expect output |
367c9886 JS |
628 | ' |
629 | ||
68cfc6f5 | 630 | cat >expect <<\EOF |
14ed05dd MG |
631 | M modified |
632 | A ../dir2/added | |
633 | ?? untracked | |
634 | ?? ../dir2/modified | |
635 | ?? ../dir2/untracked | |
14ed05dd MG |
636 | ?? ../untracked |
637 | EOF | |
638 | test_expect_success 'status -s with relative paths' ' | |
639 | ||
68cfc6f5 | 640 | (cd dir1 && git status -s) >output && |
14ed05dd MG |
641 | test_cmp expect output |
642 | ||
643 | ' | |
644 | ||
68cfc6f5 | 645 | cat >expect <<\EOF |
c521bb71 MG |
646 | M dir1/modified |
647 | A dir2/added | |
648 | ?? dir1/untracked | |
649 | ?? dir2/modified | |
650 | ?? dir2/untracked | |
c521bb71 MG |
651 | ?? untracked |
652 | EOF | |
653 | ||
654 | test_expect_success 'status --porcelain ignores relative paths setting' ' | |
655 | ||
68cfc6f5 | 656 | (cd dir1 && git status --porcelain) >output && |
c521bb71 MG |
657 | test_cmp expect output |
658 | ||
659 | ' | |
660 | ||
68cfc6f5 MG |
661 | test_expect_success 'setup unique colors' ' |
662 | ||
1d282327 | 663 | git config status.color.untracked blue && |
93fdf301 SK |
664 | git config status.color.branch green && |
665 | git config status.color.localBranch yellow && | |
666 | git config status.color.remoteBranch cyan | |
68cfc6f5 MG |
667 | |
668 | ' | |
669 | ||
cc6658e7 | 670 | test_expect_success 'status with color.ui' ' |
1c7969c9 MM |
671 | cat >expect <<\EOF && |
672 | On branch <GREEN>master<RESET> | |
75177c85 JK |
673 | Your branch and '\''upstream'\'' have diverged, |
674 | and have 1 and 2 different commits each, respectively. | |
675 | (use "git pull" to merge the remote branch into yours) | |
676 | ||
1c7969c9 MM |
677 | Changes to be committed: |
678 | (use "git reset HEAD <file>..." to unstage) | |
679 | ||
680 | <GREEN>new file: dir2/added<RESET> | |
681 | ||
682 | Changes not staged for commit: | |
683 | (use "git add <file>..." to update what will be committed) | |
684 | (use "git checkout -- <file>..." to discard changes in working directory) | |
685 | ||
686 | <RED>modified: dir1/modified<RESET> | |
687 | ||
688 | Untracked files: | |
689 | (use "git add <file>..." to include in what will be committed) | |
690 | ||
691 | <BLUE>dir1/untracked<RESET> | |
692 | <BLUE>dir2/modified<RESET> | |
693 | <BLUE>dir2/untracked<RESET> | |
1c7969c9 | 694 | <BLUE>untracked<RESET> |
2f0f7f1c | 695 | |
1c7969c9 | 696 | EOF |
c63659dd | 697 | test_config color.ui always && |
68cfc6f5 | 698 | git status | test_decode_color >output && |
cc6658e7 | 699 | test_i18ncmp expect output |
68cfc6f5 MG |
700 | ' |
701 | ||
cc6658e7 | 702 | test_expect_success 'status with color.status' ' |
c63659dd | 703 | test_config color.status always && |
68cfc6f5 | 704 | git status | test_decode_color >output && |
cc6658e7 | 705 | test_i18ncmp expect output |
68cfc6f5 MG |
706 | ' |
707 | ||
708 | cat >expect <<\EOF | |
709 | <RED>M<RESET> dir1/modified | |
710 | <GREEN>A<RESET> dir2/added | |
711 | <BLUE>??<RESET> dir1/untracked | |
712 | <BLUE>??<RESET> dir2/modified | |
713 | <BLUE>??<RESET> dir2/untracked | |
68cfc6f5 MG |
714 | <BLUE>??<RESET> untracked |
715 | EOF | |
716 | ||
717 | test_expect_success 'status -s with color.ui' ' | |
718 | ||
68cfc6f5 MG |
719 | git config color.ui always && |
720 | git status -s | test_decode_color >output && | |
721 | test_cmp expect output | |
722 | ||
723 | ' | |
724 | ||
725 | test_expect_success 'status -s with color.status' ' | |
726 | ||
727 | git config --unset color.ui && | |
728 | git config color.status always && | |
729 | git status -s | test_decode_color >output && | |
730 | test_cmp expect output | |
731 | ||
732 | ' | |
733 | ||
46077fa5 | 734 | cat >expect <<\EOF |
93fdf301 | 735 | ## <YELLOW>master<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>] |
46077fa5 MG |
736 | <RED>M<RESET> dir1/modified |
737 | <GREEN>A<RESET> dir2/added | |
738 | <BLUE>??<RESET> dir1/untracked | |
739 | <BLUE>??<RESET> dir2/modified | |
740 | <BLUE>??<RESET> dir2/untracked | |
46077fa5 MG |
741 | <BLUE>??<RESET> untracked |
742 | EOF | |
743 | ||
744 | test_expect_success 'status -s -b with color.status' ' | |
745 | ||
746 | git status -s -b | test_decode_color >output && | |
0d75bfe6 | 747 | test_i18ncmp expect output |
46077fa5 MG |
748 | |
749 | ' | |
750 | ||
68cfc6f5 MG |
751 | cat >expect <<\EOF |
752 | M dir1/modified | |
753 | A dir2/added | |
754 | ?? dir1/untracked | |
755 | ?? dir2/modified | |
756 | ?? dir2/untracked | |
68cfc6f5 MG |
757 | ?? untracked |
758 | EOF | |
759 | ||
760 | test_expect_success 'status --porcelain ignores color.ui' ' | |
761 | ||
762 | git config --unset color.status && | |
763 | git config color.ui always && | |
764 | git status --porcelain | test_decode_color >output && | |
765 | test_cmp expect output | |
766 | ||
767 | ' | |
768 | ||
769 | test_expect_success 'status --porcelain ignores color.status' ' | |
770 | ||
771 | git config --unset color.ui && | |
772 | git config color.status always && | |
773 | git status --porcelain | test_decode_color >output && | |
774 | test_cmp expect output | |
775 | ||
776 | ' | |
777 | ||
778 | # recover unconditionally from color tests | |
779 | git config --unset color.status | |
780 | git config --unset color.ui | |
781 | ||
d4a6bf1f | 782 | test_expect_success 'status --porcelain respects -b' ' |
46077fa5 MG |
783 | |
784 | git status --porcelain -b >output && | |
d4a6bf1f | 785 | { |
75177c85 | 786 | echo "## master...upstream [ahead 1, behind 2]" && |
d4a6bf1f JK |
787 | cat expect |
788 | } >tmp && | |
789 | mv tmp expect && | |
46077fa5 MG |
790 | test_cmp expect output |
791 | ||
792 | ' | |
793 | ||
46f721c8 | 794 | |
68cfc6f5 | 795 | |
cc6658e7 | 796 | test_expect_success 'status without relative paths' ' |
1c7969c9 MM |
797 | cat >expect <<\EOF && |
798 | On branch master | |
75177c85 JK |
799 | Your branch and '\''upstream'\'' have diverged, |
800 | and have 1 and 2 different commits each, respectively. | |
801 | (use "git pull" to merge the remote branch into yours) | |
802 | ||
1c7969c9 MM |
803 | Changes to be committed: |
804 | (use "git reset HEAD <file>..." to unstage) | |
805 | ||
806 | new file: dir2/added | |
807 | ||
808 | Changes not staged for commit: | |
809 | (use "git add <file>..." to update what will be committed) | |
810 | (use "git checkout -- <file>..." to discard changes in working directory) | |
46f721c8 | 811 | |
1c7969c9 MM |
812 | modified: dir1/modified |
813 | ||
814 | Untracked files: | |
815 | (use "git add <file>..." to include in what will be committed) | |
816 | ||
817 | dir1/untracked | |
818 | dir2/modified | |
819 | dir2/untracked | |
1c7969c9 | 820 | untracked |
2f0f7f1c | 821 | |
1c7969c9 | 822 | EOF |
c63659dd | 823 | test_config status.relativePaths false && |
68cfc6f5 | 824 | (cd dir1 && git status) >output && |
cc6658e7 | 825 | test_i18ncmp expect output |
46f721c8 JK |
826 | |
827 | ' | |
828 | ||
68cfc6f5 | 829 | cat >expect <<\EOF |
14ed05dd MG |
830 | M dir1/modified |
831 | A dir2/added | |
832 | ?? dir1/untracked | |
833 | ?? dir2/modified | |
834 | ?? dir2/untracked | |
14ed05dd MG |
835 | ?? untracked |
836 | EOF | |
837 | ||
838 | test_expect_success 'status -s without relative paths' ' | |
839 | ||
c63659dd | 840 | test_config status.relativePaths false && |
68cfc6f5 | 841 | (cd dir1 && git status -s) >output && |
14ed05dd MG |
842 | test_cmp expect output |
843 | ||
844 | ' | |
845 | ||
9e4b7ab6 | 846 | test_expect_success 'dry-run of partial commit excluding new file in index' ' |
1c7969c9 MM |
847 | cat >expect <<EOF && |
848 | On branch master | |
75177c85 JK |
849 | Your branch and '\''upstream'\'' have diverged, |
850 | and have 1 and 2 different commits each, respectively. | |
851 | (use "git pull" to merge the remote branch into yours) | |
852 | ||
1c7969c9 MM |
853 | Changes to be committed: |
854 | (use "git reset HEAD <file>..." to unstage) | |
855 | ||
856 | modified: dir1/modified | |
857 | ||
858 | Untracked files: | |
859 | (use "git add <file>..." to include in what will be committed) | |
860 | ||
861 | dir1/untracked | |
862 | dir2/ | |
1c7969c9 | 863 | untracked |
2f0f7f1c | 864 | |
1c7969c9 | 865 | EOF |
cc6658e7 JH |
866 | git commit --dry-run dir1/modified >output && |
867 | test_i18ncmp expect output | |
959ba670 JK |
868 | ' |
869 | ||
4c926b37 | 870 | cat >expect <<EOF |
378932d3 | 871 | :100644 100644 $EMPTY_BLOB 0000000000000000000000000000000000000000 M dir1/modified |
4c926b37 | 872 | EOF |
4bb6644d | 873 | test_expect_success 'status refreshes the index' ' |
4c926b37 MH |
874 | touch dir2/added && |
875 | git status && | |
876 | git diff-files >output && | |
877 | test_cmp expect output | |
878 | ' | |
879 | ||
e5e4a7f2 PY |
880 | test_expect_success 'setup status submodule summary' ' |
881 | test_create_repo sm && ( | |
882 | cd sm && | |
883 | >foo && | |
884 | git add foo && | |
885 | git commit -m "Add foo" | |
886 | ) && | |
887 | git add sm | |
888 | ' | |
889 | ||
cc6658e7 | 890 | test_expect_success 'status submodule summary is disabled by default' ' |
1c7969c9 MM |
891 | cat >expect <<EOF && |
892 | On branch master | |
75177c85 JK |
893 | Your branch and '\''upstream'\'' have diverged, |
894 | and have 1 and 2 different commits each, respectively. | |
895 | (use "git pull" to merge the remote branch into yours) | |
896 | ||
1c7969c9 MM |
897 | Changes to be committed: |
898 | (use "git reset HEAD <file>..." to unstage) | |
899 | ||
900 | new file: dir2/added | |
901 | new file: sm | |
902 | ||
903 | Changes not staged for commit: | |
904 | (use "git add <file>..." to update what will be committed) | |
905 | (use "git checkout -- <file>..." to discard changes in working directory) | |
906 | ||
907 | modified: dir1/modified | |
908 | ||
909 | Untracked files: | |
910 | (use "git add <file>..." to include in what will be committed) | |
911 | ||
912 | dir1/untracked | |
913 | dir2/modified | |
914 | dir2/untracked | |
1c7969c9 | 915 | untracked |
2f0f7f1c | 916 | |
1c7969c9 | 917 | EOF |
e5e4a7f2 | 918 | git status >output && |
cc6658e7 | 919 | test_i18ncmp expect output |
e5e4a7f2 PY |
920 | ' |
921 | ||
98fa4738 | 922 | # we expect the same as the previous test |
cc6658e7 | 923 | test_expect_success 'status --untracked-files=all does not show submodule' ' |
98fa4738 | 924 | git status --untracked-files=all >output && |
cc6658e7 | 925 | test_i18ncmp expect output |
e5e4a7f2 PY |
926 | ' |
927 | ||
14ed05dd MG |
928 | cat >expect <<EOF |
929 | M dir1/modified | |
930 | A dir2/added | |
931 | A sm | |
932 | ?? dir1/untracked | |
933 | ?? dir2/modified | |
934 | ?? dir2/untracked | |
14ed05dd MG |
935 | ?? untracked |
936 | EOF | |
937 | test_expect_success 'status -s submodule summary is disabled by default' ' | |
938 | git status -s >output && | |
939 | test_cmp expect output | |
940 | ' | |
941 | ||
942 | # we expect the same as the previous test | |
943 | test_expect_success 'status -s --untracked-files=all does not show submodule' ' | |
944 | git status -s --untracked-files=all >output && | |
945 | test_cmp expect output | |
946 | ' | |
947 | ||
e5e4a7f2 PY |
948 | head=$(cd sm && git rev-parse --short=7 --verify HEAD) |
949 | ||
cc6658e7 | 950 | test_expect_success 'status submodule summary' ' |
1c7969c9 MM |
951 | cat >expect <<EOF && |
952 | On branch master | |
75177c85 JK |
953 | Your branch and '\''upstream'\'' have diverged, |
954 | and have 1 and 2 different commits each, respectively. | |
955 | (use "git pull" to merge the remote branch into yours) | |
956 | ||
1c7969c9 MM |
957 | Changes to be committed: |
958 | (use "git reset HEAD <file>..." to unstage) | |
959 | ||
960 | new file: dir2/added | |
961 | new file: sm | |
962 | ||
963 | Changes not staged for commit: | |
964 | (use "git add <file>..." to update what will be committed) | |
965 | (use "git checkout -- <file>..." to discard changes in working directory) | |
966 | ||
967 | modified: dir1/modified | |
968 | ||
969 | Submodule changes to be committed: | |
970 | ||
971 | * sm 0000000...$head (1): | |
972 | > Add foo | |
973 | ||
974 | Untracked files: | |
975 | (use "git add <file>..." to include in what will be committed) | |
976 | ||
977 | dir1/untracked | |
978 | dir2/modified | |
979 | dir2/untracked | |
1c7969c9 | 980 | untracked |
2f0f7f1c | 981 | |
1c7969c9 | 982 | EOF |
e5e4a7f2 PY |
983 | git config status.submodulesummary 10 && |
984 | git status >output && | |
cc6658e7 | 985 | test_i18ncmp expect output |
e5e4a7f2 PY |
986 | ' |
987 | ||
2556b996 MM |
988 | test_expect_success 'status submodule summary with status.displayCommentPrefix=false' ' |
989 | strip_comments expect && | |
990 | git -c status.displayCommentPrefix=false status >output && | |
991 | test_i18ncmp expect output | |
992 | ' | |
993 | ||
994 | test_expect_success 'commit with submodule summary ignores status.displayCommentPrefix' ' | |
995 | commit_template_commented | |
996 | ' | |
997 | ||
14ed05dd MG |
998 | cat >expect <<EOF |
999 | M dir1/modified | |
1000 | A dir2/added | |
1001 | A sm | |
1002 | ?? dir1/untracked | |
1003 | ?? dir2/modified | |
1004 | ?? dir2/untracked | |
14ed05dd MG |
1005 | ?? untracked |
1006 | EOF | |
1007 | test_expect_success 'status -s submodule summary' ' | |
1008 | git status -s >output && | |
1009 | test_cmp expect output | |
1010 | ' | |
e5e4a7f2 | 1011 | |
1c7969c9 MM |
1012 | test_expect_success 'status submodule summary (clean submodule): commit' ' |
1013 | cat >expect <<EOF && | |
1014 | On branch master | |
75177c85 JK |
1015 | Your branch and '\''upstream'\'' have diverged, |
1016 | and have 2 and 2 different commits each, respectively. | |
1017 | (use "git pull" to merge the remote branch into yours) | |
1018 | ||
1c7969c9 MM |
1019 | Changes not staged for commit: |
1020 | (use "git add <file>..." to update what will be committed) | |
1021 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1022 | ||
1023 | modified: dir1/modified | |
1024 | ||
1025 | Untracked files: | |
1026 | (use "git add <file>..." to include in what will be committed) | |
1027 | ||
1028 | dir1/untracked | |
1029 | dir2/modified | |
1030 | dir2/untracked | |
1c7969c9 | 1031 | untracked |
2f0f7f1c | 1032 | |
e5e4a7f2 PY |
1033 | no changes added to commit (use "git add" and/or "git commit -a") |
1034 | EOF | |
cc6658e7 | 1035 | git commit -m "commit submodule" && |
e5e4a7f2 | 1036 | git config status.submodulesummary 10 && |
9e4b7ab6 | 1037 | test_must_fail git commit --dry-run >output && |
cc6658e7 | 1038 | test_i18ncmp expect output && |
9e4b7ab6 | 1039 | git status >output && |
cc6658e7 | 1040 | test_i18ncmp expect output |
e5e4a7f2 PY |
1041 | ' |
1042 | ||
14ed05dd MG |
1043 | cat >expect <<EOF |
1044 | M dir1/modified | |
1045 | ?? dir1/untracked | |
1046 | ?? dir2/modified | |
1047 | ?? dir2/untracked | |
14ed05dd MG |
1048 | ?? untracked |
1049 | EOF | |
1050 | test_expect_success 'status -s submodule summary (clean submodule)' ' | |
1051 | git status -s >output && | |
1052 | test_cmp expect output | |
1053 | ' | |
1054 | ||
000f97bd | 1055 | test_expect_success 'status -z implies porcelain' ' |
95b9f9f9 | 1056 | git status --porcelain | |
94221d22 | 1057 | perl -pe "s/\012/\000/g" >expect && |
95b9f9f9 BC |
1058 | git status -z >output && |
1059 | test_cmp expect output | |
1060 | ' | |
1061 | ||
cc6658e7 | 1062 | test_expect_success 'commit --dry-run submodule summary (--amend)' ' |
1c7969c9 MM |
1063 | cat >expect <<EOF && |
1064 | On branch master | |
75177c85 JK |
1065 | Your branch and '\''upstream'\'' have diverged, |
1066 | and have 2 and 2 different commits each, respectively. | |
1067 | (use "git pull" to merge the remote branch into yours) | |
1068 | ||
1c7969c9 MM |
1069 | Changes to be committed: |
1070 | (use "git reset HEAD^1 <file>..." to unstage) | |
1071 | ||
1072 | new file: dir2/added | |
1073 | new file: sm | |
1074 | ||
1075 | Changes not staged for commit: | |
1076 | (use "git add <file>..." to update what will be committed) | |
1077 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1078 | ||
1079 | modified: dir1/modified | |
1080 | ||
1081 | Submodule changes to be committed: | |
1082 | ||
1083 | * sm 0000000...$head (1): | |
1084 | > Add foo | |
1085 | ||
1086 | Untracked files: | |
1087 | (use "git add <file>..." to include in what will be committed) | |
1088 | ||
1089 | dir1/untracked | |
1090 | dir2/modified | |
1091 | dir2/untracked | |
1c7969c9 | 1092 | untracked |
2f0f7f1c | 1093 | |
1c7969c9 | 1094 | EOF |
e5e4a7f2 | 1095 | git config status.submodulesummary 10 && |
9e4b7ab6 | 1096 | git commit --dry-run --amend >output && |
cc6658e7 | 1097 | test_i18ncmp expect output |
e5e4a7f2 PY |
1098 | ' |
1099 | ||
c91cfd19 | 1100 | test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' ' |
b2f6fd95 MH |
1101 | ( |
1102 | chmod a-w .git && | |
1103 | # make dir1/tracked stat-dirty | |
1104 | >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked && | |
1105 | git status -s >output && | |
1106 | ! grep dir1/tracked output && | |
1107 | # make sure "status" succeeded without writing index out | |
1108 | git diff-files | grep dir1/tracked | |
1109 | ) | |
1110 | status=$? | |
1111 | chmod 775 .git | |
1112 | (exit $status) | |
1113 | ' | |
1114 | ||
c2e0940b | 1115 | (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm |
aee9c7d6 JL |
1116 | new_head=$(cd sm && git rev-parse --short=7 --verify HEAD) |
1117 | touch .gitmodules | |
1118 | ||
cc6658e7 | 1119 | test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' ' |
1c7969c9 MM |
1120 | cat > expect << EOF && |
1121 | On branch master | |
75177c85 JK |
1122 | Your branch and '\''upstream'\'' have diverged, |
1123 | and have 2 and 2 different commits each, respectively. | |
1124 | (use "git pull" to merge the remote branch into yours) | |
1125 | ||
1c7969c9 MM |
1126 | Changes to be committed: |
1127 | (use "git reset HEAD <file>..." to unstage) | |
1128 | ||
1129 | modified: sm | |
1130 | ||
1131 | Changes not staged for commit: | |
1132 | (use "git add <file>..." to update what will be committed) | |
1133 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1134 | ||
1135 | modified: dir1/modified | |
1136 | ||
1137 | Submodule changes to be committed: | |
1138 | ||
1139 | * sm $head...$new_head (1): | |
1140 | > Add bar | |
1141 | ||
1142 | Untracked files: | |
1143 | (use "git add <file>..." to include in what will be committed) | |
1144 | ||
1145 | .gitmodules | |
1146 | dir1/untracked | |
1147 | dir2/modified | |
1148 | dir2/untracked | |
1c7969c9 | 1149 | untracked |
2f0f7f1c | 1150 | |
1c7969c9 | 1151 | EOF |
cc6658e7 JH |
1152 | echo modified sm/untracked && |
1153 | git status --ignore-submodules=untracked >output && | |
1154 | test_i18ncmp expect output | |
46a958b3 JL |
1155 | ' |
1156 | ||
cc6658e7 | 1157 | test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' ' |
c63659dd | 1158 | test_config diff.ignoreSubmodules dirty && |
90e14525 | 1159 | git status >output && |
cc6658e7 | 1160 | test_i18ncmp expect output && |
302ad7a9 JL |
1161 | git config --add -f .gitmodules submodule.subname.ignore untracked && |
1162 | git config --add -f .gitmodules submodule.subname.path sm && | |
cc6658e7 JH |
1163 | git status >output && |
1164 | test_i18ncmp expect output && | |
c63659dd | 1165 | git config -f .gitmodules --remove-section submodule.subname |
302ad7a9 JL |
1166 | ' |
1167 | ||
cc6658e7 | 1168 | test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' ' |
302ad7a9 JL |
1169 | git config --add -f .gitmodules submodule.subname.ignore none && |
1170 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1171 | git config --add submodule.subname.ignore untracked && |
1172 | git config --add submodule.subname.path sm && | |
cc6658e7 JH |
1173 | git status >output && |
1174 | test_i18ncmp expect output && | |
302ad7a9 JL |
1175 | git config --remove-section submodule.subname && |
1176 | git config --remove-section -f .gitmodules submodule.subname | |
aee9c7d6 JL |
1177 | ' |
1178 | ||
cc6658e7 JH |
1179 | test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' ' |
1180 | git status --ignore-submodules=dirty >output && | |
1181 | test_i18ncmp expect output | |
46a958b3 JL |
1182 | ' |
1183 | ||
cc6658e7 | 1184 | test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' ' |
c63659dd | 1185 | test_config diff.ignoreSubmodules dirty && |
90e14525 JL |
1186 | git status >output && |
1187 | ! test -s actual && | |
302ad7a9 JL |
1188 | git config --add -f .gitmodules submodule.subname.ignore dirty && |
1189 | git config --add -f .gitmodules submodule.subname.path sm && | |
cc6658e7 JH |
1190 | git status >output && |
1191 | test_i18ncmp expect output && | |
c63659dd | 1192 | git config -f .gitmodules --remove-section submodule.subname |
302ad7a9 JL |
1193 | ' |
1194 | ||
cc6658e7 | 1195 | test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' ' |
302ad7a9 JL |
1196 | git config --add -f .gitmodules submodule.subname.ignore none && |
1197 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1198 | git config --add submodule.subname.ignore dirty && |
1199 | git config --add submodule.subname.path sm && | |
cc6658e7 JH |
1200 | git status >output && |
1201 | test_i18ncmp expect output && | |
302ad7a9 JL |
1202 | git config --remove-section submodule.subname && |
1203 | git config -f .gitmodules --remove-section submodule.subname | |
aee9c7d6 JL |
1204 | ' |
1205 | ||
cc6658e7 JH |
1206 | test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' ' |
1207 | echo modified >sm/foo && | |
1208 | git status --ignore-submodules=dirty >output && | |
1209 | test_i18ncmp expect output | |
46a958b3 JL |
1210 | ' |
1211 | ||
cc6658e7 | 1212 | test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' ' |
302ad7a9 JL |
1213 | git config --add -f .gitmodules submodule.subname.ignore dirty && |
1214 | git config --add -f .gitmodules submodule.subname.path sm && | |
cc6658e7 JH |
1215 | git status >output && |
1216 | test_i18ncmp expect output && | |
302ad7a9 JL |
1217 | git config -f .gitmodules --remove-section submodule.subname |
1218 | ' | |
1219 | ||
cc6658e7 | 1220 | test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' ' |
302ad7a9 JL |
1221 | git config --add -f .gitmodules submodule.subname.ignore none && |
1222 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1223 | git config --add submodule.subname.ignore dirty && |
1224 | git config --add submodule.subname.path sm && | |
cc6658e7 JH |
1225 | git status >output && |
1226 | test_i18ncmp expect output && | |
302ad7a9 JL |
1227 | git config --remove-section submodule.subname && |
1228 | git config -f .gitmodules --remove-section submodule.subname | |
aee9c7d6 JL |
1229 | ' |
1230 | ||
cc6658e7 | 1231 | test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' |
1c7969c9 MM |
1232 | cat > expect << EOF && |
1233 | On branch master | |
75177c85 JK |
1234 | Your branch and '\''upstream'\'' have diverged, |
1235 | and have 2 and 2 different commits each, respectively. | |
1236 | (use "git pull" to merge the remote branch into yours) | |
1237 | ||
1c7969c9 MM |
1238 | Changes to be committed: |
1239 | (use "git reset HEAD <file>..." to unstage) | |
1240 | ||
1241 | modified: sm | |
1242 | ||
1243 | Changes not staged for commit: | |
1244 | (use "git add <file>..." to update what will be committed) | |
1245 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1246 | (commit or discard the untracked or modified content in submodules) | |
1247 | ||
1248 | modified: dir1/modified | |
1249 | modified: sm (modified content) | |
1250 | ||
1251 | Submodule changes to be committed: | |
1252 | ||
1253 | * sm $head...$new_head (1): | |
1254 | > Add bar | |
1255 | ||
1256 | Untracked files: | |
1257 | (use "git add <file>..." to include in what will be committed) | |
1258 | ||
1259 | .gitmodules | |
1260 | dir1/untracked | |
1261 | dir2/modified | |
1262 | dir2/untracked | |
1c7969c9 | 1263 | untracked |
2f0f7f1c | 1264 | |
1c7969c9 | 1265 | EOF |
46a958b3 | 1266 | git status --ignore-submodules=untracked > output && |
cc6658e7 | 1267 | test_i18ncmp expect output |
46a958b3 JL |
1268 | ' |
1269 | ||
cc6658e7 | 1270 | test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" ' |
302ad7a9 JL |
1271 | git config --add -f .gitmodules submodule.subname.ignore untracked && |
1272 | git config --add -f .gitmodules submodule.subname.path sm && | |
cc6658e7 JH |
1273 | git status >output && |
1274 | test_i18ncmp expect output && | |
302ad7a9 JL |
1275 | git config -f .gitmodules --remove-section submodule.subname |
1276 | ' | |
1277 | ||
cc6658e7 | 1278 | test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" ' |
302ad7a9 JL |
1279 | git config --add -f .gitmodules submodule.subname.ignore none && |
1280 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1281 | git config --add submodule.subname.ignore untracked && |
1282 | git config --add submodule.subname.path sm && | |
cc6658e7 JH |
1283 | git status >output && |
1284 | test_i18ncmp expect output && | |
302ad7a9 JL |
1285 | git config --remove-section submodule.subname && |
1286 | git config -f .gitmodules --remove-section submodule.subname | |
aee9c7d6 JL |
1287 | ' |
1288 | ||
46a958b3 JL |
1289 | head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD) |
1290 | ||
cc6658e7 | 1291 | test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" ' |
1c7969c9 MM |
1292 | cat > expect << EOF && |
1293 | On branch master | |
75177c85 JK |
1294 | Your branch and '\''upstream'\'' have diverged, |
1295 | and have 2 and 2 different commits each, respectively. | |
1296 | (use "git pull" to merge the remote branch into yours) | |
1297 | ||
1c7969c9 MM |
1298 | Changes to be committed: |
1299 | (use "git reset HEAD <file>..." to unstage) | |
1300 | ||
1301 | modified: sm | |
1302 | ||
1303 | Changes not staged for commit: | |
1304 | (use "git add <file>..." to update what will be committed) | |
1305 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1306 | ||
1307 | modified: dir1/modified | |
1308 | modified: sm (new commits) | |
1309 | ||
1310 | Submodule changes to be committed: | |
1311 | ||
1312 | * sm $head...$new_head (1): | |
1313 | > Add bar | |
1314 | ||
1315 | Submodules changed but not updated: | |
1316 | ||
1317 | * sm $new_head...$head2 (1): | |
1318 | > 2nd commit | |
1319 | ||
1320 | Untracked files: | |
1321 | (use "git add <file>..." to include in what will be committed) | |
1322 | ||
1323 | .gitmodules | |
1324 | dir1/untracked | |
1325 | dir2/modified | |
1326 | dir2/untracked | |
1c7969c9 | 1327 | untracked |
2f0f7f1c | 1328 | |
1c7969c9 | 1329 | EOF |
46a958b3 | 1330 | git status --ignore-submodules=untracked > output && |
cc6658e7 | 1331 | test_i18ncmp expect output |
46a958b3 JL |
1332 | ' |
1333 | ||
cc6658e7 | 1334 | test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" ' |
302ad7a9 JL |
1335 | git config --add -f .gitmodules submodule.subname.ignore untracked && |
1336 | git config --add -f .gitmodules submodule.subname.path sm && | |
cc6658e7 JH |
1337 | git status >output && |
1338 | test_i18ncmp expect output && | |
302ad7a9 JL |
1339 | git config -f .gitmodules --remove-section submodule.subname |
1340 | ' | |
1341 | ||
cc6658e7 | 1342 | test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" ' |
302ad7a9 JL |
1343 | git config --add -f .gitmodules submodule.subname.ignore none && |
1344 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1345 | git config --add submodule.subname.ignore untracked && |
1346 | git config --add submodule.subname.path sm && | |
cc6658e7 JH |
1347 | git status >output && |
1348 | test_i18ncmp expect output && | |
302ad7a9 JL |
1349 | git config --remove-section submodule.subname && |
1350 | git config -f .gitmodules --remove-section submodule.subname | |
aee9c7d6 JL |
1351 | ' |
1352 | ||
cc6658e7 | 1353 | test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" ' |
46a958b3 | 1354 | git status --ignore-submodules=dirty > output && |
cc6658e7 | 1355 | test_i18ncmp expect output |
46a958b3 | 1356 | ' |
cc6658e7 | 1357 | test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" ' |
302ad7a9 JL |
1358 | git config --add -f .gitmodules submodule.subname.ignore dirty && |
1359 | git config --add -f .gitmodules submodule.subname.path sm && | |
cc6658e7 JH |
1360 | git status >output && |
1361 | test_i18ncmp expect output && | |
302ad7a9 JL |
1362 | git config -f .gitmodules --remove-section submodule.subname |
1363 | ' | |
46a958b3 | 1364 | |
cc6658e7 | 1365 | test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" ' |
302ad7a9 JL |
1366 | git config --add -f .gitmodules submodule.subname.ignore none && |
1367 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1368 | git config --add submodule.subname.ignore dirty && |
1369 | git config --add submodule.subname.path sm && | |
cc6658e7 JH |
1370 | git status >output && |
1371 | test_i18ncmp expect output && | |
302ad7a9 JL |
1372 | git config --remove-section submodule.subname && |
1373 | git config -f .gitmodules --remove-section submodule.subname | |
aee9c7d6 JL |
1374 | ' |
1375 | ||
eff80a9f JH |
1376 | cat > expect << EOF |
1377 | ; On branch master | |
75177c85 JK |
1378 | ; Your branch and 'upstream' have diverged, |
1379 | ; and have 2 and 2 different commits each, respectively. | |
1380 | ; (use "git pull" to merge the remote branch into yours) | |
1381 | ; | |
eff80a9f JH |
1382 | ; Changes to be committed: |
1383 | ; (use "git reset HEAD <file>..." to unstage) | |
1384 | ; | |
1385 | ; modified: sm | |
1386 | ; | |
1387 | ; Changes not staged for commit: | |
1388 | ; (use "git add <file>..." to update what will be committed) | |
1389 | ; (use "git checkout -- <file>..." to discard changes in working directory) | |
1390 | ; | |
1391 | ; modified: dir1/modified | |
1392 | ; modified: sm (new commits) | |
1393 | ; | |
1394 | ; Submodule changes to be committed: | |
1395 | ; | |
1396 | ; * sm $head...$new_head (1): | |
1397 | ; > Add bar | |
1398 | ; | |
1399 | ; Submodules changed but not updated: | |
1400 | ; | |
1401 | ; * sm $new_head...$head2 (1): | |
1402 | ; > 2nd commit | |
1403 | ; | |
1404 | ; Untracked files: | |
1405 | ; (use "git add <file>..." to include in what will be committed) | |
1406 | ; | |
1407 | ; .gitmodules | |
1408 | ; dir1/untracked | |
1409 | ; dir2/modified | |
1410 | ; dir2/untracked | |
eff80a9f | 1411 | ; untracked |
2f0f7f1c | 1412 | ; |
eff80a9f JH |
1413 | EOF |
1414 | ||
1415 | test_expect_success "status (core.commentchar with submodule summary)" ' | |
c63659dd | 1416 | test_config core.commentchar ";" && |
1c7969c9 | 1417 | git -c status.displayCommentPrefix=true status >output && |
eff80a9f JH |
1418 | test_i18ncmp expect output |
1419 | ' | |
1420 | ||
1421 | test_expect_success "status (core.commentchar with two chars with submodule summary)" ' | |
c63659dd | 1422 | test_config core.commentchar ";;" && |
50b54fd7 | 1423 | test_must_fail git -c status.displayCommentPrefix=true status |
eff80a9f JH |
1424 | ' |
1425 | ||
1c7969c9 MM |
1426 | test_expect_success "--ignore-submodules=all suppresses submodule summary" ' |
1427 | cat > expect << EOF && | |
1428 | On branch master | |
75177c85 JK |
1429 | Your branch and '\''upstream'\'' have diverged, |
1430 | and have 2 and 2 different commits each, respectively. | |
1431 | (use "git pull" to merge the remote branch into yours) | |
1432 | ||
1c7969c9 MM |
1433 | Changes not staged for commit: |
1434 | (use "git add <file>..." to update what will be committed) | |
1435 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1436 | ||
1437 | modified: dir1/modified | |
1438 | ||
1439 | Untracked files: | |
1440 | (use "git add <file>..." to include in what will be committed) | |
1441 | ||
1442 | .gitmodules | |
1443 | dir1/untracked | |
1444 | dir2/modified | |
1445 | dir2/untracked | |
1c7969c9 | 1446 | untracked |
2f0f7f1c | 1447 | |
46a958b3 JL |
1448 | no changes added to commit (use "git add" and/or "git commit -a") |
1449 | EOF | |
46a958b3 | 1450 | git status --ignore-submodules=all > output && |
cc6658e7 | 1451 | test_i18ncmp expect output |
46a958b3 JL |
1452 | ' |
1453 | ||
1d2f393a JL |
1454 | test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' ' |
1455 | cat > expect << EOF && | |
1456 | On branch master | |
75177c85 JK |
1457 | Your branch and '\''upstream'\'' have diverged, |
1458 | and have 2 and 2 different commits each, respectively. | |
1459 | (use "git pull" to merge the remote branch into yours) | |
1460 | ||
1d2f393a JL |
1461 | Changes to be committed: |
1462 | (use "git reset HEAD <file>..." to unstage) | |
1463 | ||
1464 | modified: sm | |
1465 | ||
1466 | Changes not staged for commit: | |
1467 | (use "git add <file>..." to update what will be committed) | |
1468 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1469 | ||
1470 | modified: dir1/modified | |
1471 | ||
1472 | Untracked files: | |
1473 | (use "git add <file>..." to include in what will be committed) | |
1474 | ||
1475 | .gitmodules | |
1476 | dir1/untracked | |
1477 | dir2/modified | |
1478 | dir2/untracked | |
1d2f393a JL |
1479 | untracked |
1480 | ||
1481 | EOF | |
302ad7a9 JL |
1482 | git config --add -f .gitmodules submodule.subname.ignore all && |
1483 | git config --add -f .gitmodules submodule.subname.path sm && | |
1484 | git status > output && | |
1edbaac3 | 1485 | test_i18ncmp expect output && |
302ad7a9 JL |
1486 | git config -f .gitmodules --remove-section submodule.subname |
1487 | ' | |
1488 | ||
1d2f393a | 1489 | test_expect_success '.git/config ignore=all suppresses unstaged submodule summary' ' |
302ad7a9 JL |
1490 | git config --add -f .gitmodules submodule.subname.ignore none && |
1491 | git config --add -f .gitmodules submodule.subname.path sm && | |
aee9c7d6 JL |
1492 | git config --add submodule.subname.ignore all && |
1493 | git config --add submodule.subname.path sm && | |
1494 | git status > output && | |
1edbaac3 | 1495 | test_i18ncmp expect output && |
302ad7a9 JL |
1496 | git config --remove-section submodule.subname && |
1497 | git config -f .gitmodules --remove-section submodule.subname | |
aee9c7d6 JL |
1498 | ' |
1499 | ||
4fb5166a JJGG |
1500 | test_expect_success 'setup of test environment' ' |
1501 | git config status.showUntrackedFiles no && | |
1502 | git status -s >expected_short && | |
1503 | git status --no-short >expected_noshort | |
1504 | ' | |
1505 | ||
1506 | test_expect_success '"status.short=true" same as "-s"' ' | |
1507 | git -c status.short=true status >actual && | |
1508 | test_cmp expected_short actual | |
1509 | ' | |
1510 | ||
1511 | test_expect_success '"status.short=true" weaker than "--no-short"' ' | |
1512 | git -c status.short=true status --no-short >actual && | |
1513 | test_cmp expected_noshort actual | |
1514 | ' | |
1515 | ||
1516 | test_expect_success '"status.short=false" same as "--no-short"' ' | |
1517 | git -c status.short=false status >actual && | |
1518 | test_cmp expected_noshort actual | |
1519 | ' | |
1520 | ||
1521 | test_expect_success '"status.short=false" weaker than "-s"' ' | |
1522 | git -c status.short=false status -s >actual && | |
1523 | test_cmp expected_short actual | |
1524 | ' | |
1525 | ||
ec85d070 JJGG |
1526 | test_expect_success '"status.branch=true" same as "-b"' ' |
1527 | git status -sb >expected_branch && | |
1528 | git -c status.branch=true status -s >actual && | |
1529 | test_cmp expected_branch actual | |
1530 | ' | |
1531 | ||
1532 | test_expect_success '"status.branch=true" different from "--no-branch"' ' | |
1533 | git status -s --no-branch >expected_nobranch && | |
1534 | git -c status.branch=true status -s >actual && | |
1535 | test_must_fail test_cmp expected_nobranch actual | |
1536 | ' | |
1537 | ||
1538 | test_expect_success '"status.branch=true" weaker than "--no-branch"' ' | |
1539 | git -c status.branch=true status -s --no-branch >actual && | |
1540 | test_cmp expected_nobranch actual | |
1541 | ' | |
1542 | ||
84b4202d JH |
1543 | test_expect_success '"status.branch=true" weaker than "--porcelain"' ' |
1544 | git -c status.branch=true status --porcelain >actual && | |
1545 | test_cmp expected_nobranch actual | |
1546 | ' | |
1547 | ||
ec85d070 JJGG |
1548 | test_expect_success '"status.branch=false" same as "--no-branch"' ' |
1549 | git -c status.branch=false status -s >actual && | |
1550 | test_cmp expected_nobranch actual | |
1551 | ' | |
1552 | ||
1553 | test_expect_success '"status.branch=false" weaker than "-b"' ' | |
1554 | git -c status.branch=false status -sb >actual && | |
1555 | test_cmp expected_branch actual | |
1556 | ' | |
1557 | ||
4fb5166a JJGG |
1558 | test_expect_success 'Restore default test environment' ' |
1559 | git config --unset status.showUntrackedFiles | |
1560 | ' | |
1561 | ||
1d2f393a JL |
1562 | test_expect_success 'git commit will commit a staged but ignored submodule' ' |
1563 | git config --add -f .gitmodules submodule.subname.ignore all && | |
1564 | git config --add -f .gitmodules submodule.subname.path sm && | |
1565 | git config --add submodule.subname.ignore all && | |
1566 | git status -s --ignore-submodules=dirty >output && | |
1567 | test_i18ngrep "^M. sm" output && | |
1568 | GIT_EDITOR="echo hello >>\"\$1\"" && | |
1569 | export GIT_EDITOR && | |
1570 | git commit -uno && | |
1571 | git status -s --ignore-submodules=dirty >output && | |
1572 | test_i18ngrep ! "^M. sm" output | |
1573 | ' | |
1574 | ||
1575 | test_expect_success 'git commit --dry-run will show a staged but ignored submodule' ' | |
1576 | git reset HEAD^ && | |
1577 | git add sm && | |
1578 | cat >expect << EOF && | |
1579 | On branch master | |
75177c85 JK |
1580 | Your branch and '\''upstream'\'' have diverged, |
1581 | and have 2 and 2 different commits each, respectively. | |
1582 | (use "git pull" to merge the remote branch into yours) | |
1583 | ||
1d2f393a JL |
1584 | Changes to be committed: |
1585 | (use "git reset HEAD <file>..." to unstage) | |
1586 | ||
1587 | modified: sm | |
1588 | ||
1589 | Changes not staged for commit: | |
1590 | (use "git add <file>..." to update what will be committed) | |
1591 | (use "git checkout -- <file>..." to discard changes in working directory) | |
1592 | ||
1593 | modified: dir1/modified | |
1594 | ||
1595 | Untracked files not listed (use -u option to show untracked files) | |
1596 | EOF | |
1597 | git commit -uno --dry-run >output && | |
1598 | test_i18ncmp expect output && | |
1599 | git status -s --ignore-submodules=dirty >output && | |
1600 | test_i18ngrep "^M. sm" output | |
1601 | ' | |
1602 | ||
c215d3d2 | 1603 | test_expect_success 'git commit -m will commit a staged but ignored submodule' ' |
1d2f393a JL |
1604 | git commit -uno -m message && |
1605 | git status -s --ignore-submodules=dirty >output && | |
4fced247 | 1606 | test_i18ngrep ! "^M. sm" output && |
1d2f393a JL |
1607 | git config --remove-section submodule.subname && |
1608 | git config -f .gitmodules --remove-section submodule.subname | |
1609 | ' | |
1610 | ||
c1b5d019 LB |
1611 | test_expect_success 'show stash info with "--show-stash"' ' |
1612 | git reset --hard && | |
1613 | git stash clear && | |
1614 | echo 1 >file && | |
1615 | git add file && | |
1616 | git stash && | |
1617 | git status >expected_default && | |
1618 | git status --show-stash >expected_with_stash && | |
1619 | test_i18ngrep "^Your stash currently has 1 entry$" expected_with_stash | |
1620 | ' | |
1621 | ||
1622 | test_expect_success 'no stash info with "--show-stash --no-show-stash"' ' | |
1623 | git status --show-stash --no-show-stash >expected_without_stash && | |
1624 | test_cmp expected_default expected_without_stash | |
1625 | ' | |
1626 | ||
1627 | test_expect_success '"status.showStash=false" weaker than "--show-stash"' ' | |
1628 | git -c status.showStash=false status --show-stash >actual && | |
1629 | test_cmp expected_with_stash actual | |
1630 | ' | |
1631 | ||
1632 | test_expect_success '"status.showStash=true" weaker than "--no-show-stash"' ' | |
1633 | git -c status.showStash=true status --no-show-stash >actual && | |
1634 | test_cmp expected_without_stash actual | |
1635 | ' | |
1636 | ||
1637 | test_expect_success 'no additionnal info if no stash entries' ' | |
1638 | git stash clear && | |
1639 | git -c status.showStash=true status >actual && | |
1640 | test_cmp expected_without_stash actual | |
1641 | ' | |
1642 | ||
4ddb1354 KS |
1643 | test_expect_success '"No commits yet" should be noted in status output' ' |
1644 | git checkout --orphan empty-branch-1 && | |
1645 | git status >output && | |
1646 | test_i18ngrep "No commits yet" output | |
1647 | ' | |
1648 | ||
1649 | test_expect_success '"No commits yet" should not be noted in status output' ' | |
1650 | git checkout --orphan empty-branch-2 && | |
1651 | test_commit test-commit-1 && | |
1652 | git status >output && | |
1653 | test_i18ngrep ! "No commits yet" output | |
1654 | ' | |
1655 | ||
1656 | test_expect_success '"Initial commit" should be noted in commit template' ' | |
1657 | git checkout --orphan empty-branch-3 && | |
1658 | touch to_be_committed_1 && | |
1659 | git add to_be_committed_1 && | |
1660 | git commit --dry-run >output && | |
1661 | test_i18ngrep "Initial commit" output | |
1662 | ' | |
1663 | ||
1664 | test_expect_success '"Initial commit" should not be noted in commit template' ' | |
1665 | git checkout --orphan empty-branch-4 && | |
1666 | test_commit test-commit-2 && | |
1667 | touch to_be_committed_2 && | |
1668 | git add to_be_committed_2 && | |
1669 | git commit --dry-run >output && | |
1670 | test_i18ngrep ! "Initial commit" output | |
1671 | ' | |
1672 | ||
367c9886 | 1673 | test_done |