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