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