Fix another invocation of git from gitk with an overly long command-line
[git/dscho.git] / t / t7508-status.sh
blob0182d168ac13080003e3311ef228f8318cc14079
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='git status'
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11 : >tracked &&
12 : >modified &&
13 mkdir dir1 &&
14 : >dir1/tracked &&
15 : >dir1/modified &&
16 mkdir dir2 &&
17 : >dir1/tracked &&
18 : >dir1/modified &&
19 git add . &&
21 git status >output &&
23 test_tick &&
24 git commit -m initial &&
25 : >untracked &&
26 : >dir1/untracked &&
27 : >dir2/untracked &&
28 echo 1 >dir1/modified &&
29 echo 2 >dir2/modified &&
30 echo 3 >dir2/added &&
31 git add dir2/added
34 test_expect_success 'status (1)' '
36 grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
40 cat >expect <<\EOF
41 # On branch master
42 # Changes to be committed:
43 # (use "git reset HEAD <file>..." to unstage)
45 # new file: dir2/added
47 # Changed but not updated:
48 # (use "git add <file>..." to update what will be committed)
49 # (use "git checkout -- <file>..." to discard changes in working directory)
51 # modified: dir1/modified
53 # Untracked files:
54 # (use "git add <file>..." to include in what will be committed)
56 # dir1/untracked
57 # dir2/modified
58 # dir2/untracked
59 # expect
60 # output
61 # untracked
62 EOF
64 test_expect_success 'status (2)' '
66 git status >output &&
67 test_cmp expect output
71 cat >expect <<\EOF
72 # On branch master
73 # Changes to be committed:
74 # new file: dir2/added
76 # Changed but not updated:
77 # modified: dir1/modified
79 # Untracked files:
80 # dir1/untracked
81 # dir2/modified
82 # dir2/untracked
83 # expect
84 # output
85 # untracked
86 EOF
88 git config advice.statusHints false
90 test_expect_success 'status (advice.statusHints false)' '
92 git status >output &&
93 test_cmp expect output
97 git config --unset advice.statusHints
99 cat >expect <<\EOF
100 M dir1/modified
101 A dir2/added
102 ?? dir1/untracked
103 ?? dir2/modified
104 ?? dir2/untracked
105 ?? expect
106 ?? output
107 ?? untracked
110 test_expect_success 'status -s' '
112 git status -s >output &&
113 test_cmp expect output
117 cat >expect <<\EOF
118 ## master
119 M dir1/modified
120 A dir2/added
121 ?? dir1/untracked
122 ?? dir2/modified
123 ?? dir2/untracked
124 ?? expect
125 ?? output
126 ?? untracked
129 test_expect_success 'status -s -b' '
131 git status -s -b >output &&
132 test_cmp expect output
136 cat >expect <<EOF
137 # On branch master
138 # Changes to be committed:
139 # (use "git reset HEAD <file>..." to unstage)
141 # new file: dir2/added
143 # Changed but not updated:
144 # (use "git add <file>..." to update what will be committed)
145 # (use "git checkout -- <file>..." to discard changes in working directory)
147 # modified: dir1/modified
149 # Untracked files not listed (use -u option to show untracked files)
151 test_expect_success 'status -uno' '
152 mkdir dir3 &&
153 : >dir3/untracked1 &&
154 : >dir3/untracked2 &&
155 git status -uno >output &&
156 test_cmp expect output
159 test_expect_success 'status (status.showUntrackedFiles no)' '
160 git config status.showuntrackedfiles no
161 git status >output &&
162 test_cmp expect output
165 cat >expect <<EOF
166 # On branch master
167 # Changes to be committed:
168 # new file: dir2/added
170 # Changed but not updated:
171 # modified: dir1/modified
173 # Untracked files not listed
175 git config advice.statusHints false
176 test_expect_success 'status -uno (advice.statusHints false)' '
177 git status -uno >output &&
178 test_cmp expect output
180 git config --unset advice.statusHints
182 cat >expect << EOF
183 M dir1/modified
184 A dir2/added
186 test_expect_success 'status -s -uno' '
187 git config --unset status.showuntrackedfiles
188 git status -s -uno >output &&
189 test_cmp expect output
192 test_expect_success 'status -s (status.showUntrackedFiles no)' '
193 git config status.showuntrackedfiles no
194 git status -s >output &&
195 test_cmp expect output
198 cat >expect <<EOF
199 # On branch master
200 # Changes to be committed:
201 # (use "git reset HEAD <file>..." to unstage)
203 # new file: dir2/added
205 # Changed but not updated:
206 # (use "git add <file>..." to update what will be committed)
207 # (use "git checkout -- <file>..." to discard changes in working directory)
209 # modified: dir1/modified
211 # Untracked files:
212 # (use "git add <file>..." to include in what will be committed)
214 # dir1/untracked
215 # dir2/modified
216 # dir2/untracked
217 # dir3/
218 # expect
219 # output
220 # untracked
222 test_expect_success 'status -unormal' '
223 git status -unormal >output &&
224 test_cmp expect output
227 test_expect_success 'status (status.showUntrackedFiles normal)' '
228 git config status.showuntrackedfiles normal
229 git status >output &&
230 test_cmp expect output
233 cat >expect <<EOF
234 M dir1/modified
235 A dir2/added
236 ?? dir1/untracked
237 ?? dir2/modified
238 ?? dir2/untracked
239 ?? dir3/
240 ?? expect
241 ?? output
242 ?? untracked
244 test_expect_success 'status -s -unormal' '
245 git config --unset status.showuntrackedfiles
246 git status -s -unormal >output &&
247 test_cmp expect output
250 test_expect_success 'status -s (status.showUntrackedFiles normal)' '
251 git config status.showuntrackedfiles normal
252 git status -s >output &&
253 test_cmp expect output
256 cat >expect <<EOF
257 # On branch master
258 # Changes to be committed:
259 # (use "git reset HEAD <file>..." to unstage)
261 # new file: dir2/added
263 # Changed but not updated:
264 # (use "git add <file>..." to update what will be committed)
265 # (use "git checkout -- <file>..." to discard changes in working directory)
267 # modified: dir1/modified
269 # Untracked files:
270 # (use "git add <file>..." to include in what will be committed)
272 # dir1/untracked
273 # dir2/modified
274 # dir2/untracked
275 # dir3/untracked1
276 # dir3/untracked2
277 # expect
278 # output
279 # untracked
281 test_expect_success 'status -uall' '
282 git status -uall >output &&
283 test_cmp expect output
285 test_expect_success 'status (status.showUntrackedFiles all)' '
286 git config status.showuntrackedfiles all
287 git status >output &&
288 rm -rf dir3 &&
289 git config --unset status.showuntrackedfiles &&
290 test_cmp expect output
293 cat >expect <<EOF
294 M dir1/modified
295 A dir2/added
296 ?? dir1/untracked
297 ?? dir2/modified
298 ?? dir2/untracked
299 ?? expect
300 ?? output
301 ?? untracked
303 test_expect_success 'status -s -uall' '
304 git config --unset status.showuntrackedfiles
305 git status -s -uall >output &&
306 test_cmp expect output
308 test_expect_success 'status -s (status.showUntrackedFiles all)' '
309 git config status.showuntrackedfiles all
310 git status -s >output &&
311 rm -rf dir3 &&
312 git config --unset status.showuntrackedfiles &&
313 test_cmp expect output
316 cat >expect <<\EOF
317 # On branch master
318 # Changes to be committed:
319 # (use "git reset HEAD <file>..." to unstage)
321 # new file: ../dir2/added
323 # Changed but not updated:
324 # (use "git add <file>..." to update what will be committed)
325 # (use "git checkout -- <file>..." to discard changes in working directory)
327 # modified: modified
329 # Untracked files:
330 # (use "git add <file>..." to include in what will be committed)
332 # untracked
333 # ../dir2/modified
334 # ../dir2/untracked
335 # ../expect
336 # ../output
337 # ../untracked
340 test_expect_success 'status with relative paths' '
342 (cd dir1 && git status) >output &&
343 test_cmp expect output
347 cat >expect <<\EOF
348 M modified
349 A ../dir2/added
350 ?? untracked
351 ?? ../dir2/modified
352 ?? ../dir2/untracked
353 ?? ../expect
354 ?? ../output
355 ?? ../untracked
357 test_expect_success 'status -s with relative paths' '
359 (cd dir1 && git status -s) >output &&
360 test_cmp expect output
364 cat >expect <<\EOF
365 M dir1/modified
366 A dir2/added
367 ?? dir1/untracked
368 ?? dir2/modified
369 ?? dir2/untracked
370 ?? expect
371 ?? output
372 ?? untracked
375 test_expect_success 'status --porcelain ignores relative paths setting' '
377 (cd dir1 && git status --porcelain) >output &&
378 test_cmp expect output
382 test_expect_success 'setup unique colors' '
384 git config status.color.untracked blue
388 cat >expect <<\EOF
389 # On branch master
390 # Changes to be committed:
391 # (use "git reset HEAD <file>..." to unstage)
393 # <GREEN>new file: dir2/added<RESET>
395 # Changed but not updated:
396 # (use "git add <file>..." to update what will be committed)
397 # (use "git checkout -- <file>..." to discard changes in working directory)
399 # <RED>modified: dir1/modified<RESET>
401 # Untracked files:
402 # (use "git add <file>..." to include in what will be committed)
404 # <BLUE>dir1/untracked<RESET>
405 # <BLUE>dir2/modified<RESET>
406 # <BLUE>dir2/untracked<RESET>
407 # <BLUE>expect<RESET>
408 # <BLUE>output<RESET>
409 # <BLUE>untracked<RESET>
412 test_expect_success 'status with color.ui' '
414 git config color.ui always &&
415 git status | test_decode_color >output &&
416 test_cmp expect output
420 test_expect_success 'status with color.status' '
422 git config --unset color.ui &&
423 git config color.status always &&
424 git status | test_decode_color >output &&
425 test_cmp expect output
429 cat >expect <<\EOF
430 <RED>M<RESET> dir1/modified
431 <GREEN>A<RESET> dir2/added
432 <BLUE>??<RESET> dir1/untracked
433 <BLUE>??<RESET> dir2/modified
434 <BLUE>??<RESET> dir2/untracked
435 <BLUE>??<RESET> expect
436 <BLUE>??<RESET> output
437 <BLUE>??<RESET> untracked
440 test_expect_success 'status -s with color.ui' '
442 git config --unset color.status &&
443 git config color.ui always &&
444 git status -s | test_decode_color >output &&
445 test_cmp expect output
449 test_expect_success 'status -s with color.status' '
451 git config --unset color.ui &&
452 git config color.status always &&
453 git status -s | test_decode_color >output &&
454 test_cmp expect output
458 cat >expect <<\EOF
459 ## <GREEN>master<RESET>
460 <RED>M<RESET> dir1/modified
461 <GREEN>A<RESET> dir2/added
462 <BLUE>??<RESET> dir1/untracked
463 <BLUE>??<RESET> dir2/modified
464 <BLUE>??<RESET> dir2/untracked
465 <BLUE>??<RESET> expect
466 <BLUE>??<RESET> output
467 <BLUE>??<RESET> untracked
470 test_expect_success 'status -s -b with color.status' '
472 git status -s -b | test_decode_color >output &&
473 test_cmp expect output
477 cat >expect <<\EOF
478 M dir1/modified
479 A dir2/added
480 ?? dir1/untracked
481 ?? dir2/modified
482 ?? dir2/untracked
483 ?? expect
484 ?? output
485 ?? untracked
488 test_expect_success 'status --porcelain ignores color.ui' '
490 git config --unset color.status &&
491 git config color.ui always &&
492 git status --porcelain | test_decode_color >output &&
493 test_cmp expect output
497 test_expect_success 'status --porcelain ignores color.status' '
499 git config --unset color.ui &&
500 git config color.status always &&
501 git status --porcelain | test_decode_color >output &&
502 test_cmp expect output
506 # recover unconditionally from color tests
507 git config --unset color.status
508 git config --unset color.ui
510 test_expect_success 'status --porcelain ignores -b' '
512 git status --porcelain -b >output &&
513 test_cmp expect output
517 cat >expect <<\EOF
518 # On branch master
519 # Changes to be committed:
520 # (use "git reset HEAD <file>..." to unstage)
522 # new file: dir2/added
524 # Changed but not updated:
525 # (use "git add <file>..." to update what will be committed)
526 # (use "git checkout -- <file>..." to discard changes in working directory)
528 # modified: dir1/modified
530 # Untracked files:
531 # (use "git add <file>..." to include in what will be committed)
533 # dir1/untracked
534 # dir2/modified
535 # dir2/untracked
536 # expect
537 # output
538 # untracked
542 test_expect_success 'status without relative paths' '
544 git config status.relativePaths false
545 (cd dir1 && git status) >output &&
546 test_cmp expect output
550 cat >expect <<\EOF
551 M dir1/modified
552 A dir2/added
553 ?? dir1/untracked
554 ?? dir2/modified
555 ?? dir2/untracked
556 ?? expect
557 ?? output
558 ?? untracked
561 test_expect_success 'status -s without relative paths' '
563 (cd dir1 && git status -s) >output &&
564 test_cmp expect output
568 cat <<EOF >expect
569 # On branch master
570 # Changes to be committed:
571 # (use "git reset HEAD <file>..." to unstage)
573 # modified: dir1/modified
575 # Untracked files:
576 # (use "git add <file>..." to include in what will be committed)
578 # dir1/untracked
579 # dir2/
580 # expect
581 # output
582 # untracked
584 test_expect_success 'dry-run of partial commit excluding new file in index' '
585 git commit --dry-run dir1/modified >output &&
586 test_cmp expect output
589 cat >expect <<EOF
590 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
592 test_expect_success 'status refreshes the index' '
593 touch dir2/added &&
594 git status &&
595 git diff-files >output &&
596 test_cmp expect output
599 test_expect_success 'setup status submodule summary' '
600 test_create_repo sm && (
601 cd sm &&
602 >foo &&
603 git add foo &&
604 git commit -m "Add foo"
605 ) &&
606 git add sm
609 cat >expect <<EOF
610 # On branch master
611 # Changes to be committed:
612 # (use "git reset HEAD <file>..." to unstage)
614 # new file: dir2/added
615 # new file: sm
617 # Changed but not updated:
618 # (use "git add <file>..." to update what will be committed)
619 # (use "git checkout -- <file>..." to discard changes in working directory)
621 # modified: dir1/modified
623 # Untracked files:
624 # (use "git add <file>..." to include in what will be committed)
626 # dir1/untracked
627 # dir2/modified
628 # dir2/untracked
629 # expect
630 # output
631 # untracked
633 test_expect_success 'status submodule summary is disabled by default' '
634 git status >output &&
635 test_cmp expect output
638 # we expect the same as the previous test
639 test_expect_success 'status --untracked-files=all does not show submodule' '
640 git status --untracked-files=all >output &&
641 test_cmp expect output
644 cat >expect <<EOF
645 M dir1/modified
646 A dir2/added
647 A sm
648 ?? dir1/untracked
649 ?? dir2/modified
650 ?? dir2/untracked
651 ?? expect
652 ?? output
653 ?? untracked
655 test_expect_success 'status -s submodule summary is disabled by default' '
656 git status -s >output &&
657 test_cmp expect output
660 # we expect the same as the previous test
661 test_expect_success 'status -s --untracked-files=all does not show submodule' '
662 git status -s --untracked-files=all >output &&
663 test_cmp expect output
666 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
668 cat >expect <<EOF
669 # On branch master
670 # Changes to be committed:
671 # (use "git reset HEAD <file>..." to unstage)
673 # new file: dir2/added
674 # new file: sm
676 # Changed but not updated:
677 # (use "git add <file>..." to update what will be committed)
678 # (use "git checkout -- <file>..." to discard changes in working directory)
680 # modified: dir1/modified
682 # Submodule changes to be committed:
684 # * sm 0000000...$head (1):
685 # > Add foo
687 # Untracked files:
688 # (use "git add <file>..." to include in what will be committed)
690 # dir1/untracked
691 # dir2/modified
692 # dir2/untracked
693 # expect
694 # output
695 # untracked
697 test_expect_success 'status submodule summary' '
698 git config status.submodulesummary 10 &&
699 git status >output &&
700 if test_have_prereq MINGW
701 then
702 dos2unix output
703 fi &&
704 test_cmp expect output
707 cat >expect <<EOF
708 M dir1/modified
709 A dir2/added
710 A sm
711 ?? dir1/untracked
712 ?? dir2/modified
713 ?? dir2/untracked
714 ?? expect
715 ?? output
716 ?? untracked
718 test_expect_success 'status -s submodule summary' '
719 git status -s >output &&
720 if test_have_prereq MINGW
721 then
722 dos2unix output
723 fi &&
724 test_cmp expect output
727 cat >expect <<EOF
728 # On branch master
729 # Changed but not updated:
730 # (use "git add <file>..." to update what will be committed)
731 # (use "git checkout -- <file>..." to discard changes in working directory)
733 # modified: dir1/modified
735 # Untracked files:
736 # (use "git add <file>..." to include in what will be committed)
738 # dir1/untracked
739 # dir2/modified
740 # dir2/untracked
741 # expect
742 # output
743 # untracked
744 no changes added to commit (use "git add" and/or "git commit -a")
746 test_expect_success 'status submodule summary (clean submodule)' '
747 git commit -m "commit submodule" &&
748 git config status.submodulesummary 10 &&
749 test_must_fail git commit --dry-run >output &&
750 if test_have_prereq MINGW
751 then
752 dos2unix output
753 fi &&
754 test_cmp expect output &&
755 git status >output &&
756 if test_have_prereq MINGW
757 then
758 dos2unix output
759 fi &&
760 test_cmp expect output
763 cat >expect <<EOF
764 M dir1/modified
765 ?? dir1/untracked
766 ?? dir2/modified
767 ?? dir2/untracked
768 ?? expect
769 ?? output
770 ?? untracked
772 test_expect_success 'status -s submodule summary (clean submodule)' '
773 git status -s >output &&
774 if test_have_prereq MINGW
775 then
776 dos2unix output
777 fi &&
778 test_cmp expect output
781 cat >expect <<EOF
782 # On branch master
783 # Changes to be committed:
784 # (use "git reset HEAD^1 <file>..." to unstage)
786 # new file: dir2/added
787 # new file: sm
789 # Changed but not updated:
790 # (use "git add <file>..." to update what will be committed)
791 # (use "git checkout -- <file>..." to discard changes in working directory)
793 # modified: dir1/modified
795 # Submodule changes to be committed:
797 # * sm 0000000...$head (1):
798 # > Add foo
800 # Untracked files:
801 # (use "git add <file>..." to include in what will be committed)
803 # dir1/untracked
804 # dir2/modified
805 # dir2/untracked
806 # expect
807 # output
808 # untracked
810 test_expect_success 'commit --dry-run submodule summary (--amend)' '
811 git config status.submodulesummary 10 &&
812 git commit --dry-run --amend >output &&
813 if test_have_prereq MINGW
814 then
815 dos2unix output
816 fi &&
817 test_cmp expect output
820 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
822 chmod a-w .git &&
823 # make dir1/tracked stat-dirty
824 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
825 git status -s >output &&
826 ! grep dir1/tracked output &&
827 # make sure "status" succeeded without writing index out
828 git diff-files | grep dir1/tracked
830 status=$?
831 chmod 775 .git
832 (exit $status)
835 (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar' && cd .. && git add sm)
836 new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
837 touch .gitmodules
839 cat > expect << EOF
840 # On branch master
841 # Changes to be committed:
842 # (use "git reset HEAD <file>..." to unstage)
844 # modified: sm
846 # Changed but not updated:
847 # (use "git add <file>..." to update what will be committed)
848 # (use "git checkout -- <file>..." to discard changes in working directory)
850 # modified: dir1/modified
852 # Submodule changes to be committed:
854 # * sm $head...$new_head (1):
855 # > Add bar
857 # Untracked files:
858 # (use "git add <file>..." to include in what will be committed)
860 # .gitmodules
861 # dir1/untracked
862 # dir2/modified
863 # dir2/untracked
864 # expect
865 # output
866 # untracked
869 test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
870 echo modified > sm/untracked &&
871 git status --ignore-submodules=untracked > output &&
872 test_cmp expect output
875 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
876 git config diff.ignoreSubmodules dirty &&
877 git status >output &&
878 test_cmp expect output &&
879 git config --add -f .gitmodules submodule.subname.ignore untracked &&
880 git config --add -f .gitmodules submodule.subname.path sm &&
881 git status > output &&
882 test_cmp expect output &&
883 git config -f .gitmodules --remove-section submodule.subname &&
884 git config --unset diff.ignoreSubmodules
887 test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
888 git config --add -f .gitmodules submodule.subname.ignore none &&
889 git config --add -f .gitmodules submodule.subname.path sm &&
890 git config --add submodule.subname.ignore untracked &&
891 git config --add submodule.subname.path sm &&
892 git status > output &&
893 test_cmp expect output &&
894 git config --remove-section submodule.subname &&
895 git config --remove-section -f .gitmodules submodule.subname
898 test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
899 git status --ignore-submodules=dirty > output &&
900 test_cmp expect output
903 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
904 git config diff.ignoreSubmodules dirty &&
905 git status >output &&
906 ! test -s actual &&
907 git config --add -f .gitmodules submodule.subname.ignore dirty &&
908 git config --add -f .gitmodules submodule.subname.path sm &&
909 git status > output &&
910 test_cmp expect output &&
911 git config -f .gitmodules --remove-section submodule.subname &&
912 git config --unset diff.ignoreSubmodules
915 test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
916 git config --add -f .gitmodules submodule.subname.ignore none &&
917 git config --add -f .gitmodules submodule.subname.path sm &&
918 git config --add submodule.subname.ignore dirty &&
919 git config --add submodule.subname.path sm &&
920 git status > output &&
921 test_cmp expect output &&
922 git config --remove-section submodule.subname &&
923 git config -f .gitmodules --remove-section submodule.subname
926 test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
927 echo modified > sm/foo &&
928 git status --ignore-submodules=dirty > output &&
929 test_cmp expect output
932 test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
933 git config --add -f .gitmodules submodule.subname.ignore dirty &&
934 git config --add -f .gitmodules submodule.subname.path sm &&
935 git status > output &&
936 test_cmp expect output &&
937 git config -f .gitmodules --remove-section submodule.subname
940 test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
941 git config --add -f .gitmodules submodule.subname.ignore none &&
942 git config --add -f .gitmodules submodule.subname.path sm &&
943 git config --add submodule.subname.ignore dirty &&
944 git config --add submodule.subname.path sm &&
945 git status > output &&
946 test_cmp expect output &&
947 git config --remove-section submodule.subname &&
948 git config -f .gitmodules --remove-section submodule.subname
951 cat > expect << EOF
952 # On branch master
953 # Changes to be committed:
954 # (use "git reset HEAD <file>..." to unstage)
956 # modified: sm
958 # Changed but not updated:
959 # (use "git add <file>..." to update what will be committed)
960 # (use "git checkout -- <file>..." to discard changes in working directory)
961 # (commit or discard the untracked or modified content in submodules)
963 # modified: dir1/modified
964 # modified: sm (modified content)
966 # Submodule changes to be committed:
968 # * sm $head...$new_head (1):
969 # > Add bar
971 # Untracked files:
972 # (use "git add <file>..." to include in what will be committed)
974 # .gitmodules
975 # dir1/untracked
976 # dir2/modified
977 # dir2/untracked
978 # expect
979 # output
980 # untracked
983 test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
984 git status --ignore-submodules=untracked > output &&
985 test_cmp expect output
988 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
989 git config --add -f .gitmodules submodule.subname.ignore untracked &&
990 git config --add -f .gitmodules submodule.subname.path sm &&
991 git status > output &&
992 test_cmp expect output &&
993 git config -f .gitmodules --remove-section submodule.subname
996 test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
997 git config --add -f .gitmodules submodule.subname.ignore none &&
998 git config --add -f .gitmodules submodule.subname.path sm &&
999 git config --add submodule.subname.ignore untracked &&
1000 git config --add submodule.subname.path sm &&
1001 git status > output &&
1002 test_cmp expect output &&
1003 git config --remove-section submodule.subname &&
1004 git config -f .gitmodules --remove-section submodule.subname
1007 head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
1009 cat > expect << EOF
1010 # On branch master
1011 # Changes to be committed:
1012 # (use "git reset HEAD <file>..." to unstage)
1014 # modified: sm
1016 # Changed but not updated:
1017 # (use "git add <file>..." to update what will be committed)
1018 # (use "git checkout -- <file>..." to discard changes in working directory)
1020 # modified: dir1/modified
1021 # modified: sm (new commits)
1023 # Submodule changes to be committed:
1025 # * sm $head...$new_head (1):
1026 # > Add bar
1028 # Submodules changed but not updated:
1030 # * sm $new_head...$head2 (1):
1031 # > 2nd commit
1033 # Untracked files:
1034 # (use "git add <file>..." to include in what will be committed)
1036 # .gitmodules
1037 # dir1/untracked
1038 # dir2/modified
1039 # dir2/untracked
1040 # expect
1041 # output
1042 # untracked
1045 test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1046 git status --ignore-submodules=untracked > output &&
1047 test_cmp expect output
1050 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1051 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1052 git config --add -f .gitmodules submodule.subname.path sm &&
1053 git status > output &&
1054 test_cmp expect output &&
1055 git config -f .gitmodules --remove-section submodule.subname
1058 test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
1059 git config --add -f .gitmodules submodule.subname.ignore none &&
1060 git config --add -f .gitmodules submodule.subname.path sm &&
1061 git config --add submodule.subname.ignore untracked &&
1062 git config --add submodule.subname.path sm &&
1063 git status > output &&
1064 test_cmp expect output &&
1065 git config --remove-section submodule.subname &&
1066 git config -f .gitmodules --remove-section submodule.subname
1069 test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
1070 git status --ignore-submodules=dirty > output &&
1071 test_cmp expect output
1073 test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1074 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1075 git config --add -f .gitmodules submodule.subname.path sm &&
1076 git status > output &&
1077 test_cmp expect output &&
1078 git config -f .gitmodules --remove-section submodule.subname
1081 test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
1082 git config --add -f .gitmodules submodule.subname.ignore none &&
1083 git config --add -f .gitmodules submodule.subname.path sm &&
1084 git config --add submodule.subname.ignore dirty &&
1085 git config --add submodule.subname.path sm &&
1086 git status > output &&
1087 test_cmp expect output &&
1088 git config --remove-section submodule.subname &&
1089 git config -f .gitmodules --remove-section submodule.subname
1092 cat > expect << EOF
1093 # On branch master
1094 # Changed but not updated:
1095 # (use "git add <file>..." to update what will be committed)
1096 # (use "git checkout -- <file>..." to discard changes in working directory)
1098 # modified: dir1/modified
1100 # Untracked files:
1101 # (use "git add <file>..." to include in what will be committed)
1103 # .gitmodules
1104 # dir1/untracked
1105 # dir2/modified
1106 # dir2/untracked
1107 # expect
1108 # output
1109 # untracked
1110 no changes added to commit (use "git add" and/or "git commit -a")
1113 test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1114 git status --ignore-submodules=all > output &&
1115 test_cmp expect output
1118 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1119 git config --add -f .gitmodules submodule.subname.ignore all &&
1120 git config --add -f .gitmodules submodule.subname.path sm &&
1121 git status > output &&
1122 test_cmp expect output &&
1123 git config -f .gitmodules --remove-section submodule.subname
1126 test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1127 git config --add -f .gitmodules submodule.subname.ignore none &&
1128 git config --add -f .gitmodules submodule.subname.path sm &&
1129 git config --add submodule.subname.ignore all &&
1130 git config --add submodule.subname.path sm &&
1131 git status > output &&
1132 test_cmp expect output &&
1133 git config --remove-section submodule.subname &&
1134 git config -f .gitmodules --remove-section submodule.subname
1137 test_done