Work around funny CR issue
[git/dscho.git] / t / t7508-status.sh
blob93b447bfe9bb55a411440ebd3d13c98da366f2cb
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='git status'
8 . ./test-lib.sh
10 test_expect_success 'status -h in broken repository' '
11 mkdir broken &&
12 test_when_finished "rm -fr broken" &&
14 cd broken &&
15 git init &&
16 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
17 test_expect_code 129 git status -h >usage 2>&1
18 ) &&
19 grep "[Uu]sage" broken/usage
22 test_expect_success 'commit -h in broken repository' '
23 mkdir broken &&
24 test_when_finished "rm -fr broken" &&
26 cd broken &&
27 git init &&
28 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
29 test_expect_code 129 git commit -h >usage 2>&1
30 ) &&
31 grep "[Uu]sage" broken/usage
34 test_expect_success 'setup' '
35 : >tracked &&
36 : >modified &&
37 mkdir dir1 &&
38 : >dir1/tracked &&
39 : >dir1/modified &&
40 mkdir dir2 &&
41 : >dir1/tracked &&
42 : >dir1/modified &&
43 git add . &&
45 git status >output &&
47 test_tick &&
48 git commit -m initial &&
49 : >untracked &&
50 : >dir1/untracked &&
51 : >dir2/untracked &&
52 echo 1 >dir1/modified &&
53 echo 2 >dir2/modified &&
54 echo 3 >dir2/added &&
55 git add dir2/added
58 test_expect_success 'status (1)' '
60 grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
64 cat >expect <<\EOF
65 # On branch master
66 # Changes to be committed:
67 # (use "git reset HEAD <file>..." to unstage)
69 # new file: dir2/added
71 # Changes not staged for commit:
72 # (use "git add <file>..." to update what will be committed)
73 # (use "git checkout -- <file>..." to discard changes in working directory)
75 # modified: dir1/modified
77 # Untracked files:
78 # (use "git add <file>..." to include in what will be committed)
80 # dir1/untracked
81 # dir2/modified
82 # dir2/untracked
83 # expect
84 # output
85 # untracked
86 EOF
88 test_expect_success 'status (2)' '
90 git status >output &&
91 test_cmp expect output
95 cat >expect <<\EOF
96 # On branch master
97 # Changes to be committed:
98 # new file: dir2/added
100 # Changes not staged for commit:
101 # modified: dir1/modified
103 # Untracked files:
104 # dir1/untracked
105 # dir2/modified
106 # dir2/untracked
107 # expect
108 # output
109 # untracked
112 git config advice.statusHints false
114 test_expect_success 'status (advice.statusHints false)' '
116 git status >output &&
117 test_cmp expect output
121 git config --unset advice.statusHints
123 cat >expect <<\EOF
124 M dir1/modified
125 A dir2/added
126 ?? dir1/untracked
127 ?? dir2/modified
128 ?? dir2/untracked
129 ?? expect
130 ?? output
131 ?? untracked
134 test_expect_success 'status -s' '
136 git status -s >output &&
137 test_cmp expect output
141 cat >expect <<\EOF
142 ## master
143 M dir1/modified
144 A dir2/added
145 ?? dir1/untracked
146 ?? dir2/modified
147 ?? dir2/untracked
148 ?? expect
149 ?? output
150 ?? untracked
153 test_expect_success 'status -s -b' '
155 git status -s -b >output &&
156 test_cmp expect output
160 cat >expect <<EOF
161 # On branch master
162 # Changes to be committed:
163 # (use "git reset HEAD <file>..." to unstage)
165 # new file: dir2/added
167 # Changes not staged for commit:
168 # (use "git add <file>..." to update what will be committed)
169 # (use "git checkout -- <file>..." to discard changes in working directory)
171 # modified: dir1/modified
173 # Untracked files not listed (use -u option to show untracked files)
175 test_expect_success 'status -uno' '
176 mkdir dir3 &&
177 : >dir3/untracked1 &&
178 : >dir3/untracked2 &&
179 git status -uno >output &&
180 test_cmp expect output
183 test_expect_success 'status (status.showUntrackedFiles no)' '
184 git config status.showuntrackedfiles no
185 git status >output &&
186 test_cmp expect output
189 cat >expect <<EOF
190 # On branch master
191 # Changes to be committed:
192 # new file: dir2/added
194 # Changes not staged for commit:
195 # modified: dir1/modified
197 # Untracked files not listed
199 git config advice.statusHints false
200 test_expect_success 'status -uno (advice.statusHints false)' '
201 git status -uno >output &&
202 test_cmp expect output
204 git config --unset advice.statusHints
206 cat >expect << EOF
207 M dir1/modified
208 A dir2/added
210 test_expect_success 'status -s -uno' '
211 git config --unset status.showuntrackedfiles
212 git status -s -uno >output &&
213 test_cmp expect output
216 test_expect_success 'status -s (status.showUntrackedFiles no)' '
217 git config status.showuntrackedfiles no
218 git status -s >output &&
219 test_cmp expect output
222 cat >expect <<EOF
223 # On branch master
224 # Changes to be committed:
225 # (use "git reset HEAD <file>..." to unstage)
227 # new file: dir2/added
229 # Changes not staged for commit:
230 # (use "git add <file>..." to update what will be committed)
231 # (use "git checkout -- <file>..." to discard changes in working directory)
233 # modified: dir1/modified
235 # Untracked files:
236 # (use "git add <file>..." to include in what will be committed)
238 # dir1/untracked
239 # dir2/modified
240 # dir2/untracked
241 # dir3/
242 # expect
243 # output
244 # untracked
246 test_expect_success 'status -unormal' '
247 git status -unormal >output &&
248 test_cmp expect output
251 test_expect_success 'status (status.showUntrackedFiles normal)' '
252 git config status.showuntrackedfiles normal
253 git status >output &&
254 test_cmp expect output
257 cat >expect <<EOF
258 M dir1/modified
259 A dir2/added
260 ?? dir1/untracked
261 ?? dir2/modified
262 ?? dir2/untracked
263 ?? dir3/
264 ?? expect
265 ?? output
266 ?? untracked
268 test_expect_success 'status -s -unormal' '
269 git config --unset status.showuntrackedfiles
270 git status -s -unormal >output &&
271 test_cmp expect output
274 test_expect_success 'status -s (status.showUntrackedFiles normal)' '
275 git config status.showuntrackedfiles normal
276 git status -s >output &&
277 test_cmp expect output
280 cat >expect <<EOF
281 # On branch master
282 # Changes to be committed:
283 # (use "git reset HEAD <file>..." to unstage)
285 # new file: dir2/added
287 # Changes not staged for commit:
288 # (use "git add <file>..." to update what will be committed)
289 # (use "git checkout -- <file>..." to discard changes in working directory)
291 # modified: dir1/modified
293 # Untracked files:
294 # (use "git add <file>..." to include in what will be committed)
296 # dir1/untracked
297 # dir2/modified
298 # dir2/untracked
299 # dir3/untracked1
300 # dir3/untracked2
301 # expect
302 # output
303 # untracked
305 test_expect_success 'status -uall' '
306 git status -uall >output &&
307 test_cmp expect output
309 test_expect_success 'status (status.showUntrackedFiles all)' '
310 git config status.showuntrackedfiles all
311 git status >output &&
312 rm -rf dir3 &&
313 git config --unset status.showuntrackedfiles &&
314 test_cmp expect output
317 cat >expect <<EOF
318 M dir1/modified
319 A dir2/added
320 ?? dir1/untracked
321 ?? dir2/modified
322 ?? dir2/untracked
323 ?? expect
324 ?? output
325 ?? untracked
327 test_expect_success 'status -s -uall' '
328 git config --unset status.showuntrackedfiles
329 git status -s -uall >output &&
330 test_cmp expect output
332 test_expect_success 'status -s (status.showUntrackedFiles all)' '
333 git config status.showuntrackedfiles all
334 git status -s >output &&
335 rm -rf dir3 &&
336 git config --unset status.showuntrackedfiles &&
337 test_cmp expect output
340 cat >expect <<\EOF
341 # On branch master
342 # Changes to be committed:
343 # (use "git reset HEAD <file>..." to unstage)
345 # new file: ../dir2/added
347 # Changes not staged for commit:
348 # (use "git add <file>..." to update what will be committed)
349 # (use "git checkout -- <file>..." to discard changes in working directory)
351 # modified: modified
353 # Untracked files:
354 # (use "git add <file>..." to include in what will be committed)
356 # untracked
357 # ../dir2/modified
358 # ../dir2/untracked
359 # ../expect
360 # ../output
361 # ../untracked
364 test_expect_success 'status with relative paths' '
366 (cd dir1 && git status) >output &&
367 test_cmp expect output
371 cat >expect <<\EOF
372 M modified
373 A ../dir2/added
374 ?? untracked
375 ?? ../dir2/modified
376 ?? ../dir2/untracked
377 ?? ../expect
378 ?? ../output
379 ?? ../untracked
381 test_expect_success 'status -s with relative paths' '
383 (cd dir1 && git status -s) >output &&
384 test_cmp expect output
388 cat >expect <<\EOF
389 M dir1/modified
390 A dir2/added
391 ?? dir1/untracked
392 ?? dir2/modified
393 ?? dir2/untracked
394 ?? expect
395 ?? output
396 ?? untracked
399 test_expect_success 'status --porcelain ignores relative paths setting' '
401 (cd dir1 && git status --porcelain) >output &&
402 test_cmp expect output
406 test_expect_success 'setup unique colors' '
408 git config status.color.untracked blue &&
409 git config status.color.branch green
413 cat >expect <<\EOF
414 # On branch <GREEN>master<RESET>
415 # Changes to be committed:
416 # (use "git reset HEAD <file>..." to unstage)
418 # <GREEN>new file: dir2/added<RESET>
420 # Changes not staged for commit:
421 # (use "git add <file>..." to update what will be committed)
422 # (use "git checkout -- <file>..." to discard changes in working directory)
424 # <RED>modified: dir1/modified<RESET>
426 # Untracked files:
427 # (use "git add <file>..." to include in what will be committed)
429 # <BLUE>dir1/untracked<RESET>
430 # <BLUE>dir2/modified<RESET>
431 # <BLUE>dir2/untracked<RESET>
432 # <BLUE>expect<RESET>
433 # <BLUE>output<RESET>
434 # <BLUE>untracked<RESET>
437 test_expect_success 'status with color.ui' '
439 git config color.ui always &&
440 git status | test_decode_color >output &&
441 test_cmp expect output
445 test_expect_success 'status with color.status' '
447 git config --unset color.ui &&
448 git config color.status always &&
449 git status | test_decode_color >output &&
450 test_cmp expect output
454 cat >expect <<\EOF
455 <RED>M<RESET> dir1/modified
456 <GREEN>A<RESET> dir2/added
457 <BLUE>??<RESET> dir1/untracked
458 <BLUE>??<RESET> dir2/modified
459 <BLUE>??<RESET> dir2/untracked
460 <BLUE>??<RESET> expect
461 <BLUE>??<RESET> output
462 <BLUE>??<RESET> untracked
465 test_expect_success 'status -s with color.ui' '
467 git config --unset color.status &&
468 git config color.ui always &&
469 git status -s | test_decode_color >output &&
470 test_cmp expect output
474 test_expect_success 'status -s with color.status' '
476 git config --unset color.ui &&
477 git config color.status always &&
478 git status -s | test_decode_color >output &&
479 test_cmp expect output
483 cat >expect <<\EOF
484 ## <GREEN>master<RESET>
485 <RED>M<RESET> dir1/modified
486 <GREEN>A<RESET> dir2/added
487 <BLUE>??<RESET> dir1/untracked
488 <BLUE>??<RESET> dir2/modified
489 <BLUE>??<RESET> dir2/untracked
490 <BLUE>??<RESET> expect
491 <BLUE>??<RESET> output
492 <BLUE>??<RESET> untracked
495 test_expect_success 'status -s -b with color.status' '
497 git status -s -b | test_decode_color >output &&
498 test_cmp expect output
502 cat >expect <<\EOF
503 M dir1/modified
504 A dir2/added
505 ?? dir1/untracked
506 ?? dir2/modified
507 ?? dir2/untracked
508 ?? expect
509 ?? output
510 ?? untracked
513 test_expect_success 'status --porcelain ignores color.ui' '
515 git config --unset color.status &&
516 git config color.ui always &&
517 git status --porcelain | test_decode_color >output &&
518 test_cmp expect output
522 test_expect_success 'status --porcelain ignores color.status' '
524 git config --unset color.ui &&
525 git config color.status always &&
526 git status --porcelain | test_decode_color >output &&
527 test_cmp expect output
531 # recover unconditionally from color tests
532 git config --unset color.status
533 git config --unset color.ui
535 test_expect_success 'status --porcelain ignores -b' '
537 git status --porcelain -b >output &&
538 test_cmp expect output
542 cat >expect <<\EOF
543 # On branch master
544 # Changes to be committed:
545 # (use "git reset HEAD <file>..." to unstage)
547 # new file: dir2/added
549 # Changes not staged for commit:
550 # (use "git add <file>..." to update what will be committed)
551 # (use "git checkout -- <file>..." to discard changes in working directory)
553 # modified: dir1/modified
555 # Untracked files:
556 # (use "git add <file>..." to include in what will be committed)
558 # dir1/untracked
559 # dir2/modified
560 # dir2/untracked
561 # expect
562 # output
563 # untracked
567 test_expect_success 'status without relative paths' '
569 git config status.relativePaths false
570 (cd dir1 && git status) >output &&
571 test_cmp expect output
575 cat >expect <<\EOF
576 M dir1/modified
577 A dir2/added
578 ?? dir1/untracked
579 ?? dir2/modified
580 ?? dir2/untracked
581 ?? expect
582 ?? output
583 ?? untracked
586 test_expect_success 'status -s without relative paths' '
588 (cd dir1 && git status -s) >output &&
589 test_cmp expect output
593 cat <<EOF >expect
594 # On branch master
595 # Changes to be committed:
596 # (use "git reset HEAD <file>..." to unstage)
598 # modified: dir1/modified
600 # Untracked files:
601 # (use "git add <file>..." to include in what will be committed)
603 # dir1/untracked
604 # dir2/
605 # expect
606 # output
607 # untracked
609 test_expect_success 'dry-run of partial commit excluding new file in index' '
610 git commit --dry-run dir1/modified >output &&
611 test_cmp expect output
614 cat >expect <<EOF
615 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
617 test_expect_success 'status refreshes the index' '
618 touch dir2/added &&
619 git status &&
620 git diff-files >output &&
621 test_cmp expect output
624 test_expect_success 'setup status submodule summary' '
625 test_create_repo sm && (
626 cd sm &&
627 >foo &&
628 git add foo &&
629 git commit -m "Add foo"
630 ) &&
631 git add sm
634 cat >expect <<EOF
635 # On branch master
636 # Changes to be committed:
637 # (use "git reset HEAD <file>..." to unstage)
639 # new file: dir2/added
640 # new file: sm
642 # Changes not staged for commit:
643 # (use "git add <file>..." to update what will be committed)
644 # (use "git checkout -- <file>..." to discard changes in working directory)
646 # modified: dir1/modified
648 # Untracked files:
649 # (use "git add <file>..." to include in what will be committed)
651 # dir1/untracked
652 # dir2/modified
653 # dir2/untracked
654 # expect
655 # output
656 # untracked
658 test_expect_success 'status submodule summary is disabled by default' '
659 git status >output &&
660 test_cmp expect output
663 # we expect the same as the previous test
664 test_expect_success 'status --untracked-files=all does not show submodule' '
665 git status --untracked-files=all >output &&
666 test_cmp expect output
669 cat >expect <<EOF
670 M dir1/modified
671 A dir2/added
672 A sm
673 ?? dir1/untracked
674 ?? dir2/modified
675 ?? dir2/untracked
676 ?? expect
677 ?? output
678 ?? untracked
680 test_expect_success 'status -s submodule summary is disabled by default' '
681 git status -s >output &&
682 test_cmp expect output
685 # we expect the same as the previous test
686 test_expect_success 'status -s --untracked-files=all does not show submodule' '
687 git status -s --untracked-files=all >output &&
688 test_cmp expect output
691 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
693 cat >expect <<EOF
694 # On branch master
695 # Changes to be committed:
696 # (use "git reset HEAD <file>..." to unstage)
698 # new file: dir2/added
699 # new file: sm
701 # Changes not staged for commit:
702 # (use "git add <file>..." to update what will be committed)
703 # (use "git checkout -- <file>..." to discard changes in working directory)
705 # modified: dir1/modified
707 # Submodule changes to be committed:
709 # * sm 0000000...$head (1):
710 # > Add foo
712 # Untracked files:
713 # (use "git add <file>..." to include in what will be committed)
715 # dir1/untracked
716 # dir2/modified
717 # dir2/untracked
718 # expect
719 # output
720 # untracked
722 test_expect_success 'status submodule summary' '
723 git config status.submodulesummary 10 &&
724 git status >output &&
725 if test_have_prereq MINGW
726 then
727 dos2unix output
728 fi &&
729 test_cmp expect output
732 cat >expect <<EOF
733 M dir1/modified
734 A dir2/added
735 A sm
736 ?? dir1/untracked
737 ?? dir2/modified
738 ?? dir2/untracked
739 ?? expect
740 ?? output
741 ?? untracked
743 test_expect_success 'status -s submodule summary' '
744 git status -s >output &&
745 if test_have_prereq MINGW
746 then
747 dos2unix output
748 fi &&
749 test_cmp expect output
752 cat >expect <<EOF
753 # On branch master
754 # Changes not staged for commit:
755 # (use "git add <file>..." to update what will be committed)
756 # (use "git checkout -- <file>..." to discard changes in working directory)
758 # modified: dir1/modified
760 # Untracked files:
761 # (use "git add <file>..." to include in what will be committed)
763 # dir1/untracked
764 # dir2/modified
765 # dir2/untracked
766 # expect
767 # output
768 # untracked
769 no changes added to commit (use "git add" and/or "git commit -a")
771 test_expect_success 'status submodule summary (clean submodule)' '
772 git commit -m "commit submodule" &&
773 git config status.submodulesummary 10 &&
774 test_must_fail git commit --dry-run >output &&
775 if test_have_prereq MINGW
776 then
777 dos2unix output
778 fi &&
779 test_cmp expect output &&
780 git status >output &&
781 if test_have_prereq MINGW
782 then
783 dos2unix output
784 fi &&
785 test_cmp expect output
788 cat >expect <<EOF
789 M dir1/modified
790 ?? dir1/untracked
791 ?? dir2/modified
792 ?? dir2/untracked
793 ?? expect
794 ?? output
795 ?? untracked
797 test_expect_success 'status -s submodule summary (clean submodule)' '
798 git status -s >output &&
799 if test_have_prereq MINGW
800 then
801 dos2unix output
802 fi &&
803 test_cmp expect output
806 cat >expect <<EOF
807 # On branch master
808 # Changes to be committed:
809 # (use "git reset HEAD^1 <file>..." to unstage)
811 # new file: dir2/added
812 # new file: sm
814 # Changes not staged for commit:
815 # (use "git add <file>..." to update what will be committed)
816 # (use "git checkout -- <file>..." to discard changes in working directory)
818 # modified: dir1/modified
820 # Submodule changes to be committed:
822 # * sm 0000000...$head (1):
823 # > Add foo
825 # Untracked files:
826 # (use "git add <file>..." to include in what will be committed)
828 # dir1/untracked
829 # dir2/modified
830 # dir2/untracked
831 # expect
832 # output
833 # untracked
835 test_expect_success 'commit --dry-run submodule summary (--amend)' '
836 git config status.submodulesummary 10 &&
837 git commit --dry-run --amend >output &&
838 if test_have_prereq MINGW
839 then
840 dos2unix output
841 fi &&
842 test_cmp expect output
845 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
847 chmod a-w .git &&
848 # make dir1/tracked stat-dirty
849 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
850 git status -s >output &&
851 ! grep dir1/tracked output &&
852 # make sure "status" succeeded without writing index out
853 git diff-files | grep dir1/tracked
855 status=$?
856 chmod 775 .git
857 (exit $status)
860 (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
861 new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
862 touch .gitmodules
864 cat > expect << EOF
865 # On branch master
866 # Changes to be committed:
867 # (use "git reset HEAD <file>..." to unstage)
869 # modified: sm
871 # Changes not staged for commit:
872 # (use "git add <file>..." to update what will be committed)
873 # (use "git checkout -- <file>..." to discard changes in working directory)
875 # modified: dir1/modified
877 # Submodule changes to be committed:
879 # * sm $head...$new_head (1):
880 # > Add bar
882 # Untracked files:
883 # (use "git add <file>..." to include in what will be committed)
885 # .gitmodules
886 # dir1/untracked
887 # dir2/modified
888 # dir2/untracked
889 # expect
890 # output
891 # untracked
894 test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
895 echo modified > sm/untracked &&
896 git status --ignore-submodules=untracked > output &&
897 test_cmp expect output
900 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
901 git config diff.ignoreSubmodules dirty &&
902 git status >output &&
903 test_cmp expect output &&
904 git config --add -f .gitmodules submodule.subname.ignore untracked &&
905 git config --add -f .gitmodules submodule.subname.path sm &&
906 git status > output &&
907 test_cmp expect output &&
908 git config -f .gitmodules --remove-section submodule.subname &&
909 git config --unset diff.ignoreSubmodules
912 test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
913 git config --add -f .gitmodules submodule.subname.ignore none &&
914 git config --add -f .gitmodules submodule.subname.path sm &&
915 git config --add submodule.subname.ignore untracked &&
916 git config --add submodule.subname.path sm &&
917 git status > output &&
918 test_cmp expect output &&
919 git config --remove-section submodule.subname &&
920 git config --remove-section -f .gitmodules submodule.subname
923 test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
924 git status --ignore-submodules=dirty > output &&
925 test_cmp expect output
928 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
929 git config diff.ignoreSubmodules dirty &&
930 git status >output &&
931 ! test -s actual &&
932 git config --add -f .gitmodules submodule.subname.ignore dirty &&
933 git config --add -f .gitmodules submodule.subname.path sm &&
934 git status > output &&
935 test_cmp expect output &&
936 git config -f .gitmodules --remove-section submodule.subname &&
937 git config --unset diff.ignoreSubmodules
940 test_expect_success '.git/config ignore=dirty suppresses submodules with untracked 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 test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
952 echo modified > sm/foo &&
953 git status --ignore-submodules=dirty > output &&
954 test_cmp expect output
957 test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
958 git config --add -f .gitmodules submodule.subname.ignore dirty &&
959 git config --add -f .gitmodules submodule.subname.path sm &&
960 git status > output &&
961 test_cmp expect output &&
962 git config -f .gitmodules --remove-section submodule.subname
965 test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
966 git config --add -f .gitmodules submodule.subname.ignore none &&
967 git config --add -f .gitmodules submodule.subname.path sm &&
968 git config --add submodule.subname.ignore dirty &&
969 git config --add submodule.subname.path sm &&
970 git status > output &&
971 test_cmp expect output &&
972 git config --remove-section submodule.subname &&
973 git config -f .gitmodules --remove-section submodule.subname
976 cat > expect << EOF
977 # On branch master
978 # Changes to be committed:
979 # (use "git reset HEAD <file>..." to unstage)
981 # modified: sm
983 # Changes not staged for commit:
984 # (use "git add <file>..." to update what will be committed)
985 # (use "git checkout -- <file>..." to discard changes in working directory)
986 # (commit or discard the untracked or modified content in submodules)
988 # modified: dir1/modified
989 # modified: sm (modified content)
991 # Submodule changes to be committed:
993 # * sm $head...$new_head (1):
994 # > Add bar
996 # Untracked files:
997 # (use "git add <file>..." to include in what will be committed)
999 # .gitmodules
1000 # dir1/untracked
1001 # dir2/modified
1002 # dir2/untracked
1003 # expect
1004 # output
1005 # untracked
1008 test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1009 git status --ignore-submodules=untracked > output &&
1010 test_cmp expect output
1013 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1014 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1015 git config --add -f .gitmodules submodule.subname.path sm &&
1016 git status > output &&
1017 test_cmp expect output &&
1018 git config -f .gitmodules --remove-section submodule.subname
1021 test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
1022 git config --add -f .gitmodules submodule.subname.ignore none &&
1023 git config --add -f .gitmodules submodule.subname.path sm &&
1024 git config --add submodule.subname.ignore untracked &&
1025 git config --add submodule.subname.path sm &&
1026 git status > output &&
1027 test_cmp expect output &&
1028 git config --remove-section submodule.subname &&
1029 git config -f .gitmodules --remove-section submodule.subname
1032 head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
1034 cat > expect << EOF
1035 # On branch master
1036 # Changes to be committed:
1037 # (use "git reset HEAD <file>..." to unstage)
1039 # modified: sm
1041 # Changes not staged for commit:
1042 # (use "git add <file>..." to update what will be committed)
1043 # (use "git checkout -- <file>..." to discard changes in working directory)
1045 # modified: dir1/modified
1046 # modified: sm (new commits)
1048 # Submodule changes to be committed:
1050 # * sm $head...$new_head (1):
1051 # > Add bar
1053 # Submodules changed but not updated:
1055 # * sm $new_head...$head2 (1):
1056 # > 2nd commit
1058 # Untracked files:
1059 # (use "git add <file>..." to include in what will be committed)
1061 # .gitmodules
1062 # dir1/untracked
1063 # dir2/modified
1064 # dir2/untracked
1065 # expect
1066 # output
1067 # untracked
1070 test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1071 git status --ignore-submodules=untracked > output &&
1072 test_cmp expect output
1075 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1076 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1077 git config --add -f .gitmodules submodule.subname.path sm &&
1078 git status > output &&
1079 test_cmp expect output &&
1080 git config -f .gitmodules --remove-section submodule.subname
1083 test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
1084 git config --add -f .gitmodules submodule.subname.ignore none &&
1085 git config --add -f .gitmodules submodule.subname.path sm &&
1086 git config --add submodule.subname.ignore untracked &&
1087 git config --add submodule.subname.path sm &&
1088 git status > output &&
1089 test_cmp expect output &&
1090 git config --remove-section submodule.subname &&
1091 git config -f .gitmodules --remove-section submodule.subname
1094 test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
1095 git status --ignore-submodules=dirty > output &&
1096 test_cmp expect output
1098 test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1099 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1100 git config --add -f .gitmodules submodule.subname.path sm &&
1101 git status > output &&
1102 test_cmp expect output &&
1103 git config -f .gitmodules --remove-section submodule.subname
1106 test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
1107 git config --add -f .gitmodules submodule.subname.ignore none &&
1108 git config --add -f .gitmodules submodule.subname.path sm &&
1109 git config --add submodule.subname.ignore dirty &&
1110 git config --add submodule.subname.path sm &&
1111 git status > output &&
1112 test_cmp expect output &&
1113 git config --remove-section submodule.subname &&
1114 git config -f .gitmodules --remove-section submodule.subname
1117 cat > expect << EOF
1118 # On branch master
1119 # Changes not staged for commit:
1120 # (use "git add <file>..." to update what will be committed)
1121 # (use "git checkout -- <file>..." to discard changes in working directory)
1123 # modified: dir1/modified
1125 # Untracked files:
1126 # (use "git add <file>..." to include in what will be committed)
1128 # .gitmodules
1129 # dir1/untracked
1130 # dir2/modified
1131 # dir2/untracked
1132 # expect
1133 # output
1134 # untracked
1135 no changes added to commit (use "git add" and/or "git commit -a")
1138 test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1139 git status --ignore-submodules=all > output &&
1140 test_cmp expect output
1143 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1144 git config --add -f .gitmodules submodule.subname.ignore all &&
1145 git config --add -f .gitmodules submodule.subname.path sm &&
1146 git status > output &&
1147 test_cmp expect output &&
1148 git config -f .gitmodules --remove-section submodule.subname
1151 test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1152 git config --add -f .gitmodules submodule.subname.ignore none &&
1153 git config --add -f .gitmodules submodule.subname.path sm &&
1154 git config --add submodule.subname.ignore all &&
1155 git config --add submodule.subname.path sm &&
1156 git status > output &&
1157 test_cmp expect output &&
1158 git config --remove-section submodule.subname &&
1159 git config -f .gitmodules --remove-section submodule.subname
1162 test_done