Merge branch 'master' of git://repo.or.cz/alt-git
[git/mingw.git] / t / t7508-status.sh
blob0478101857605af47b61393ec70e0b89428869d2
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='git status'
8 case $(uname -s) in
9 *MINGW*) GIT_TEST_CMP="diff -uw";;
10 esac
12 . ./test-lib.sh
14 test_expect_success 'setup' '
15 : >tracked &&
16 : >modified &&
17 mkdir dir1 &&
18 : >dir1/tracked &&
19 : >dir1/modified &&
20 mkdir dir2 &&
21 : >dir1/tracked &&
22 : >dir1/modified &&
23 git add . &&
25 git status >output &&
27 test_tick &&
28 git commit -m initial &&
29 : >untracked &&
30 : >dir1/untracked &&
31 : >dir2/untracked &&
32 echo 1 >dir1/modified &&
33 echo 2 >dir2/modified &&
34 echo 3 >dir2/added &&
35 git add dir2/added
38 test_expect_success 'status (1)' '
40 grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
44 cat >expect <<\EOF
45 # On branch master
46 # Changes to be committed:
47 # (use "git reset HEAD <file>..." to unstage)
49 # new file: dir2/added
51 # Changed but not updated:
52 # (use "git add <file>..." to update what will be committed)
53 # (use "git checkout -- <file>..." to discard changes in working directory)
55 # modified: dir1/modified
57 # Untracked files:
58 # (use "git add <file>..." to include in what will be committed)
60 # dir1/untracked
61 # dir2/modified
62 # dir2/untracked
63 # expect
64 # output
65 # untracked
66 EOF
68 test_expect_success 'status (2)' '
70 git status >output &&
71 test_cmp expect output
75 cat >expect <<\EOF
76 # On branch master
77 # Changes to be committed:
78 # new file: dir2/added
80 # Changed but not updated:
81 # modified: dir1/modified
83 # Untracked files:
84 # dir1/untracked
85 # dir2/modified
86 # dir2/untracked
87 # expect
88 # output
89 # untracked
90 EOF
92 git config advice.statusHints false
94 test_expect_success 'status (advice.statusHints false)' '
96 git status >output &&
97 test_cmp expect output
101 git config --unset advice.statusHints
103 cat >expect <<\EOF
104 M dir1/modified
105 A dir2/added
106 ?? dir1/untracked
107 ?? dir2/modified
108 ?? dir2/untracked
109 ?? expect
110 ?? output
111 ?? untracked
114 test_expect_success 'status -s' '
116 git status -s >output &&
117 test_cmp expect output
121 cat >expect <<\EOF
122 ## master
123 M dir1/modified
124 A dir2/added
125 ?? dir1/untracked
126 ?? dir2/modified
127 ?? dir2/untracked
128 ?? expect
129 ?? output
130 ?? untracked
133 test_expect_success 'status -s -b' '
135 git status -s -b >output &&
136 test_cmp expect output
140 cat >expect <<EOF
141 # On branch master
142 # Changes to be committed:
143 # (use "git reset HEAD <file>..." to unstage)
145 # new file: dir2/added
147 # Changed but not updated:
148 # (use "git add <file>..." to update what will be committed)
149 # (use "git checkout -- <file>..." to discard changes in working directory)
151 # modified: dir1/modified
153 # Untracked files not listed (use -u option to show untracked files)
155 test_expect_success 'status -uno' '
156 mkdir dir3 &&
157 : >dir3/untracked1 &&
158 : >dir3/untracked2 &&
159 git status -uno >output &&
160 test_cmp expect output
163 test_expect_success 'status (status.showUntrackedFiles no)' '
164 git config status.showuntrackedfiles no
165 git status >output &&
166 test_cmp expect output
169 cat >expect <<EOF
170 # On branch master
171 # Changes to be committed:
172 # new file: dir2/added
174 # Changed but not updated:
175 # modified: dir1/modified
177 # Untracked files not listed
179 git config advice.statusHints false
180 test_expect_success 'status -uno (advice.statusHints false)' '
181 git status -uno >output &&
182 test_cmp expect output
184 git config --unset advice.statusHints
186 cat >expect << EOF
187 M dir1/modified
188 A dir2/added
190 test_expect_success 'status -s -uno' '
191 git config --unset status.showuntrackedfiles
192 git status -s -uno >output &&
193 test_cmp expect output
196 test_expect_success 'status -s (status.showUntrackedFiles no)' '
197 git config status.showuntrackedfiles no
198 git status -s >output &&
199 test_cmp expect output
202 cat >expect <<EOF
203 # On branch master
204 # Changes to be committed:
205 # (use "git reset HEAD <file>..." to unstage)
207 # new file: dir2/added
209 # Changed but not updated:
210 # (use "git add <file>..." to update what will be committed)
211 # (use "git checkout -- <file>..." to discard changes in working directory)
213 # modified: dir1/modified
215 # Untracked files:
216 # (use "git add <file>..." to include in what will be committed)
218 # dir1/untracked
219 # dir2/modified
220 # dir2/untracked
221 # dir3/
222 # expect
223 # output
224 # untracked
226 test_expect_success 'status -unormal' '
227 git status -unormal >output &&
228 test_cmp expect output
231 test_expect_success 'status (status.showUntrackedFiles normal)' '
232 git config status.showuntrackedfiles normal
233 git status >output &&
234 test_cmp expect output
237 cat >expect <<EOF
238 M dir1/modified
239 A dir2/added
240 ?? dir1/untracked
241 ?? dir2/modified
242 ?? dir2/untracked
243 ?? dir3/
244 ?? expect
245 ?? output
246 ?? untracked
248 test_expect_success 'status -s -unormal' '
249 git config --unset status.showuntrackedfiles
250 git status -s -unormal >output &&
251 test_cmp expect output
254 test_expect_success 'status -s (status.showUntrackedFiles normal)' '
255 git config status.showuntrackedfiles normal
256 git status -s >output &&
257 test_cmp expect output
260 cat >expect <<EOF
261 # On branch master
262 # Changes to be committed:
263 # (use "git reset HEAD <file>..." to unstage)
265 # new file: dir2/added
267 # Changed but not updated:
268 # (use "git add <file>..." to update what will be committed)
269 # (use "git checkout -- <file>..." to discard changes in working directory)
271 # modified: dir1/modified
273 # Untracked files:
274 # (use "git add <file>..." to include in what will be committed)
276 # dir1/untracked
277 # dir2/modified
278 # dir2/untracked
279 # dir3/untracked1
280 # dir3/untracked2
281 # expect
282 # output
283 # untracked
285 test_expect_success 'status -uall' '
286 git status -uall >output &&
287 test_cmp expect output
289 test_expect_success 'status (status.showUntrackedFiles all)' '
290 git config status.showuntrackedfiles all
291 git status >output &&
292 rm -rf dir3 &&
293 git config --unset status.showuntrackedfiles &&
294 test_cmp expect output
297 cat >expect <<EOF
298 M dir1/modified
299 A dir2/added
300 ?? dir1/untracked
301 ?? dir2/modified
302 ?? dir2/untracked
303 ?? expect
304 ?? output
305 ?? untracked
307 test_expect_success 'status -s -uall' '
308 git config --unset status.showuntrackedfiles
309 git status -s -uall >output &&
310 test_cmp expect output
312 test_expect_success 'status -s (status.showUntrackedFiles all)' '
313 git config status.showuntrackedfiles all
314 git status -s >output &&
315 rm -rf dir3 &&
316 git config --unset status.showuntrackedfiles &&
317 test_cmp expect output
320 cat >expect <<\EOF
321 # On branch master
322 # Changes to be committed:
323 # (use "git reset HEAD <file>..." to unstage)
325 # new file: ../dir2/added
327 # Changed but not updated:
328 # (use "git add <file>..." to update what will be committed)
329 # (use "git checkout -- <file>..." to discard changes in working directory)
331 # modified: modified
333 # Untracked files:
334 # (use "git add <file>..." to include in what will be committed)
336 # untracked
337 # ../dir2/modified
338 # ../dir2/untracked
339 # ../expect
340 # ../output
341 # ../untracked
344 test_expect_success 'status with relative paths' '
346 (cd dir1 && git status) >output &&
347 test_cmp expect output
351 cat >expect <<\EOF
352 M modified
353 A ../dir2/added
354 ?? untracked
355 ?? ../dir2/modified
356 ?? ../dir2/untracked
357 ?? ../expect
358 ?? ../output
359 ?? ../untracked
361 test_expect_success 'status -s with relative paths' '
363 (cd dir1 && git status -s) >output &&
364 test_cmp expect output
368 cat >expect <<\EOF
369 M dir1/modified
370 A dir2/added
371 ?? dir1/untracked
372 ?? dir2/modified
373 ?? dir2/untracked
374 ?? expect
375 ?? output
376 ?? untracked
379 test_expect_success 'status --porcelain ignores relative paths setting' '
381 (cd dir1 && git status --porcelain) >output &&
382 test_cmp expect output
386 test_expect_success 'setup unique colors' '
388 git config status.color.untracked blue
392 cat >expect <<\EOF
393 # On branch master
394 # Changes to be committed:
395 # (use "git reset HEAD <file>..." to unstage)
397 # <GREEN>new file: dir2/added<RESET>
399 # Changed but not updated:
400 # (use "git add <file>..." to update what will be committed)
401 # (use "git checkout -- <file>..." to discard changes in working directory)
403 # <RED>modified: dir1/modified<RESET>
405 # Untracked files:
406 # (use "git add <file>..." to include in what will be committed)
408 # <BLUE>dir1/untracked<RESET>
409 # <BLUE>dir2/modified<RESET>
410 # <BLUE>dir2/untracked<RESET>
411 # <BLUE>expect<RESET>
412 # <BLUE>output<RESET>
413 # <BLUE>untracked<RESET>
416 test_expect_success 'status with color.ui' '
418 git config color.ui always &&
419 git status | test_decode_color >output &&
420 test_cmp expect output
424 test_expect_success 'status with color.status' '
426 git config --unset color.ui &&
427 git config color.status always &&
428 git status | test_decode_color >output &&
429 test_cmp expect output
433 cat >expect <<\EOF
434 <RED>M<RESET> dir1/modified
435 <GREEN>A<RESET> dir2/added
436 <BLUE>??<RESET> dir1/untracked
437 <BLUE>??<RESET> dir2/modified
438 <BLUE>??<RESET> dir2/untracked
439 <BLUE>??<RESET> expect
440 <BLUE>??<RESET> output
441 <BLUE>??<RESET> untracked
444 test_expect_success 'status -s with color.ui' '
446 git config --unset color.status &&
447 git config color.ui always &&
448 git status -s | test_decode_color >output &&
449 test_cmp expect output
453 test_expect_success 'status -s with color.status' '
455 git config --unset color.ui &&
456 git config color.status always &&
457 git status -s | test_decode_color >output &&
458 test_cmp expect output
462 cat >expect <<\EOF
463 ## <GREEN>master<RESET>
464 <RED>M<RESET> dir1/modified
465 <GREEN>A<RESET> dir2/added
466 <BLUE>??<RESET> dir1/untracked
467 <BLUE>??<RESET> dir2/modified
468 <BLUE>??<RESET> dir2/untracked
469 <BLUE>??<RESET> expect
470 <BLUE>??<RESET> output
471 <BLUE>??<RESET> untracked
474 test_expect_success 'status -s -b with color.status' '
476 git status -s -b | test_decode_color >output &&
477 test_cmp expect output
481 cat >expect <<\EOF
482 M dir1/modified
483 A dir2/added
484 ?? dir1/untracked
485 ?? dir2/modified
486 ?? dir2/untracked
487 ?? expect
488 ?? output
489 ?? untracked
492 test_expect_success 'status --porcelain ignores color.ui' '
494 git config --unset color.status &&
495 git config color.ui always &&
496 git status --porcelain | test_decode_color >output &&
497 test_cmp expect output
501 test_expect_success 'status --porcelain ignores color.status' '
503 git config --unset color.ui &&
504 git config color.status always &&
505 git status --porcelain | test_decode_color >output &&
506 test_cmp expect output
510 # recover unconditionally from color tests
511 git config --unset color.status
512 git config --unset color.ui
514 test_expect_success 'status --porcelain ignores -b' '
516 git status --porcelain -b >output &&
517 test_cmp expect output
521 cat >expect <<\EOF
522 # On branch master
523 # Changes to be committed:
524 # (use "git reset HEAD <file>..." to unstage)
526 # new file: dir2/added
528 # Changed but not updated:
529 # (use "git add <file>..." to update what will be committed)
530 # (use "git checkout -- <file>..." to discard changes in working directory)
532 # modified: dir1/modified
534 # Untracked files:
535 # (use "git add <file>..." to include in what will be committed)
537 # dir1/untracked
538 # dir2/modified
539 # dir2/untracked
540 # expect
541 # output
542 # untracked
546 test_expect_success 'status without relative paths' '
548 git config status.relativePaths false
549 (cd dir1 && git status) >output &&
550 test_cmp expect output
554 cat >expect <<\EOF
555 M dir1/modified
556 A dir2/added
557 ?? dir1/untracked
558 ?? dir2/modified
559 ?? dir2/untracked
560 ?? expect
561 ?? output
562 ?? untracked
565 test_expect_success 'status -s without relative paths' '
567 (cd dir1 && git status -s) >output &&
568 test_cmp expect output
572 cat <<EOF >expect
573 # On branch master
574 # Changes to be committed:
575 # (use "git reset HEAD <file>..." to unstage)
577 # modified: dir1/modified
579 # Untracked files:
580 # (use "git add <file>..." to include in what will be committed)
582 # dir1/untracked
583 # dir2/
584 # expect
585 # output
586 # untracked
588 test_expect_success 'dry-run of partial commit excluding new file in index' '
589 git commit --dry-run dir1/modified >output &&
590 test_cmp expect output
593 cat >expect <<EOF
594 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
596 test_expect_success 'status refreshes the index' '
597 touch dir2/added &&
598 git status &&
599 git diff-files >output &&
600 test_cmp expect output
603 test_expect_success 'setup status submodule summary' '
604 test_create_repo sm && (
605 cd sm &&
606 >foo &&
607 git add foo &&
608 git commit -m "Add foo"
609 ) &&
610 git add sm
613 cat >expect <<EOF
614 # On branch master
615 # Changes to be committed:
616 # (use "git reset HEAD <file>..." to unstage)
618 # new file: dir2/added
619 # new file: sm
621 # Changed but not updated:
622 # (use "git add <file>..." to update what will be committed)
623 # (use "git checkout -- <file>..." to discard changes in working directory)
625 # modified: dir1/modified
627 # Untracked files:
628 # (use "git add <file>..." to include in what will be committed)
630 # dir1/untracked
631 # dir2/modified
632 # dir2/untracked
633 # expect
634 # output
635 # untracked
637 test_expect_success 'status submodule summary is disabled by default' '
638 git status >output &&
639 test_cmp expect output
642 # we expect the same as the previous test
643 test_expect_success 'status --untracked-files=all does not show submodule' '
644 git status --untracked-files=all >output &&
645 test_cmp expect output
648 cat >expect <<EOF
649 M dir1/modified
650 A dir2/added
651 A sm
652 ?? dir1/untracked
653 ?? dir2/modified
654 ?? dir2/untracked
655 ?? expect
656 ?? output
657 ?? untracked
659 test_expect_success 'status -s submodule summary is disabled by default' '
660 git status -s >output &&
661 test_cmp expect output
664 # we expect the same as the previous test
665 test_expect_success 'status -s --untracked-files=all does not show submodule' '
666 git status -s --untracked-files=all >output &&
667 test_cmp expect output
670 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
672 cat >expect <<EOF
673 # On branch master
674 # Changes to be committed:
675 # (use "git reset HEAD <file>..." to unstage)
677 # new file: dir2/added
678 # new file: sm
680 # Changed but not updated:
681 # (use "git add <file>..." to update what will be committed)
682 # (use "git checkout -- <file>..." to discard changes in working directory)
684 # modified: dir1/modified
686 # Submodule changes to be committed:
688 # * sm 0000000...$head (1):
689 # > Add foo
691 # Untracked files:
692 # (use "git add <file>..." to include in what will be committed)
694 # dir1/untracked
695 # dir2/modified
696 # dir2/untracked
697 # expect
698 # output
699 # untracked
701 test_expect_success 'status submodule summary' '
702 git config status.submodulesummary 10 &&
703 git status >output &&
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 test_cmp expect output
723 cat >expect <<EOF
724 # On branch master
725 # Changed but not updated:
726 # (use "git add <file>..." to update what will be committed)
727 # (use "git checkout -- <file>..." to discard changes in working directory)
729 # modified: dir1/modified
731 # Untracked files:
732 # (use "git add <file>..." to include in what will be committed)
734 # dir1/untracked
735 # dir2/modified
736 # dir2/untracked
737 # expect
738 # output
739 # untracked
740 no changes added to commit (use "git add" and/or "git commit -a")
742 test_expect_success 'status submodule summary (clean submodule)' '
743 git commit -m "commit submodule" &&
744 git config status.submodulesummary 10 &&
745 test_must_fail git commit --dry-run >output &&
746 test_cmp expect output &&
747 git status >output &&
748 test_cmp expect output
751 cat >expect <<EOF
752 M dir1/modified
753 ?? dir1/untracked
754 ?? dir2/modified
755 ?? dir2/untracked
756 ?? expect
757 ?? output
758 ?? untracked
760 test_expect_success 'status -s submodule summary (clean submodule)' '
761 git status -s >output &&
762 test_cmp expect output
765 cat >expect <<EOF
766 # On branch master
767 # Changes to be committed:
768 # (use "git reset HEAD^1 <file>..." to unstage)
770 # new file: dir2/added
771 # new file: sm
773 # Changed but not updated:
774 # (use "git add <file>..." to update what will be committed)
775 # (use "git checkout -- <file>..." to discard changes in working directory)
777 # modified: dir1/modified
779 # Submodule changes to be committed:
781 # * sm 0000000...$head (1):
782 # > Add foo
784 # Untracked files:
785 # (use "git add <file>..." to include in what will be committed)
787 # dir1/untracked
788 # dir2/modified
789 # dir2/untracked
790 # expect
791 # output
792 # untracked
794 test_expect_success 'commit --dry-run submodule summary (--amend)' '
795 git config status.submodulesummary 10 &&
796 git commit --dry-run --amend >output &&
797 test_cmp expect output
800 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
802 chmod a-w .git &&
803 # make dir1/tracked stat-dirty
804 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
805 git status -s >output &&
806 ! grep dir1/tracked output &&
807 # make sure "status" succeeded without writing index out
808 git diff-files | grep dir1/tracked
810 status=$?
811 chmod 775 .git
812 (exit $status)
815 (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
816 new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
817 touch .gitmodules
819 cat > expect << EOF
820 # On branch master
821 # Changes to be committed:
822 # (use "git reset HEAD <file>..." to unstage)
824 # modified: sm
826 # Changed but not updated:
827 # (use "git add <file>..." to update what will be committed)
828 # (use "git checkout -- <file>..." to discard changes in working directory)
830 # modified: dir1/modified
832 # Submodule changes to be committed:
834 # * sm $head...$new_head (1):
835 # > Add bar
837 # Untracked files:
838 # (use "git add <file>..." to include in what will be committed)
840 # .gitmodules
841 # dir1/untracked
842 # dir2/modified
843 # dir2/untracked
844 # expect
845 # output
846 # untracked
849 test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
850 echo modified > sm/untracked &&
851 git status --ignore-submodules=untracked > output &&
852 test_cmp expect output
855 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
856 git config diff.ignoreSubmodules dirty &&
857 git status >output &&
858 test_cmp expect output &&
859 git config --add -f .gitmodules submodule.subname.ignore untracked &&
860 git config --add -f .gitmodules submodule.subname.path sm &&
861 git status > output &&
862 test_cmp expect output &&
863 git config -f .gitmodules --remove-section submodule.subname &&
864 git config --unset diff.ignoreSubmodules
867 test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
868 git config --add -f .gitmodules submodule.subname.ignore none &&
869 git config --add -f .gitmodules submodule.subname.path sm &&
870 git config --add submodule.subname.ignore untracked &&
871 git config --add submodule.subname.path sm &&
872 git status > output &&
873 test_cmp expect output &&
874 git config --remove-section submodule.subname &&
875 git config --remove-section -f .gitmodules submodule.subname
878 test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
879 git status --ignore-submodules=dirty > output &&
880 test_cmp expect output
883 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
884 git config diff.ignoreSubmodules dirty &&
885 git status >output &&
886 ! test -s actual &&
887 git config --add -f .gitmodules submodule.subname.ignore dirty &&
888 git config --add -f .gitmodules submodule.subname.path sm &&
889 git status > output &&
890 test_cmp expect output &&
891 git config -f .gitmodules --remove-section submodule.subname &&
892 git config --unset diff.ignoreSubmodules
895 test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
896 git config --add -f .gitmodules submodule.subname.ignore none &&
897 git config --add -f .gitmodules submodule.subname.path sm &&
898 git config --add submodule.subname.ignore dirty &&
899 git config --add submodule.subname.path sm &&
900 git status > output &&
901 test_cmp expect output &&
902 git config --remove-section submodule.subname &&
903 git config -f .gitmodules --remove-section submodule.subname
906 test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
907 echo modified > sm/foo &&
908 git status --ignore-submodules=dirty > output &&
909 test_cmp expect output
912 test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
913 git config --add -f .gitmodules submodule.subname.ignore dirty &&
914 git config --add -f .gitmodules submodule.subname.path sm &&
915 git status > output &&
916 test_cmp expect output &&
917 git config -f .gitmodules --remove-section submodule.subname
920 test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
921 git config --add -f .gitmodules submodule.subname.ignore none &&
922 git config --add -f .gitmodules submodule.subname.path sm &&
923 git config --add submodule.subname.ignore dirty &&
924 git config --add submodule.subname.path sm &&
925 git status > output &&
926 test_cmp expect output &&
927 git config --remove-section submodule.subname &&
928 git config -f .gitmodules --remove-section submodule.subname
931 cat > expect << EOF
932 # On branch master
933 # Changes to be committed:
934 # (use "git reset HEAD <file>..." to unstage)
936 # modified: sm
938 # Changed but not updated:
939 # (use "git add <file>..." to update what will be committed)
940 # (use "git checkout -- <file>..." to discard changes in working directory)
941 # (commit or discard the untracked or modified content in submodules)
943 # modified: dir1/modified
944 # modified: sm (modified content)
946 # Submodule changes to be committed:
948 # * sm $head...$new_head (1):
949 # > Add bar
951 # Untracked files:
952 # (use "git add <file>..." to include in what will be committed)
954 # .gitmodules
955 # dir1/untracked
956 # dir2/modified
957 # dir2/untracked
958 # expect
959 # output
960 # untracked
963 test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
964 git status --ignore-submodules=untracked > output &&
965 test_cmp expect output
968 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
969 git config --add -f .gitmodules submodule.subname.ignore untracked &&
970 git config --add -f .gitmodules submodule.subname.path sm &&
971 git status > output &&
972 test_cmp expect output &&
973 git config -f .gitmodules --remove-section submodule.subname
976 test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
977 git config --add -f .gitmodules submodule.subname.ignore none &&
978 git config --add -f .gitmodules submodule.subname.path sm &&
979 git config --add submodule.subname.ignore untracked &&
980 git config --add submodule.subname.path sm &&
981 git status > output &&
982 test_cmp expect output &&
983 git config --remove-section submodule.subname &&
984 git config -f .gitmodules --remove-section submodule.subname
987 head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
989 cat > expect << EOF
990 # On branch master
991 # Changes to be committed:
992 # (use "git reset HEAD <file>..." to unstage)
994 # modified: sm
996 # Changed but not updated:
997 # (use "git add <file>..." to update what will be committed)
998 # (use "git checkout -- <file>..." to discard changes in working directory)
1000 # modified: dir1/modified
1001 # modified: sm (new commits)
1003 # Submodule changes to be committed:
1005 # * sm $head...$new_head (1):
1006 # > Add bar
1008 # Submodules changed but not updated:
1010 # * sm $new_head...$head2 (1):
1011 # > 2nd commit
1013 # Untracked files:
1014 # (use "git add <file>..." to include in what will be committed)
1016 # .gitmodules
1017 # dir1/untracked
1018 # dir2/modified
1019 # dir2/untracked
1020 # expect
1021 # output
1022 # untracked
1025 test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1026 git status --ignore-submodules=untracked > output &&
1027 test_cmp expect output
1030 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1031 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1032 git config --add -f .gitmodules submodule.subname.path sm &&
1033 git status > output &&
1034 test_cmp expect output &&
1035 git config -f .gitmodules --remove-section submodule.subname
1038 test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
1039 git config --add -f .gitmodules submodule.subname.ignore none &&
1040 git config --add -f .gitmodules submodule.subname.path sm &&
1041 git config --add submodule.subname.ignore untracked &&
1042 git config --add submodule.subname.path sm &&
1043 git status > output &&
1044 test_cmp expect output &&
1045 git config --remove-section submodule.subname &&
1046 git config -f .gitmodules --remove-section submodule.subname
1049 test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
1050 git status --ignore-submodules=dirty > output &&
1051 test_cmp expect output
1053 test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1054 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1055 git config --add -f .gitmodules submodule.subname.path sm &&
1056 git status > output &&
1057 test_cmp expect output &&
1058 git config -f .gitmodules --remove-section submodule.subname
1061 test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
1062 git config --add -f .gitmodules submodule.subname.ignore none &&
1063 git config --add -f .gitmodules submodule.subname.path sm &&
1064 git config --add submodule.subname.ignore dirty &&
1065 git config --add submodule.subname.path sm &&
1066 git status > output &&
1067 test_cmp expect output &&
1068 git config --remove-section submodule.subname &&
1069 git config -f .gitmodules --remove-section submodule.subname
1072 cat > expect << EOF
1073 # On branch master
1074 # Changed but not updated:
1075 # (use "git add <file>..." to update what will be committed)
1076 # (use "git checkout -- <file>..." to discard changes in working directory)
1078 # modified: dir1/modified
1080 # Untracked files:
1081 # (use "git add <file>..." to include in what will be committed)
1083 # .gitmodules
1084 # dir1/untracked
1085 # dir2/modified
1086 # dir2/untracked
1087 # expect
1088 # output
1089 # untracked
1090 no changes added to commit (use "git add" and/or "git commit -a")
1093 test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1094 git status --ignore-submodules=all > output &&
1095 test_cmp expect output
1098 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1099 git config --add -f .gitmodules submodule.subname.ignore all &&
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_failure '.git/config ignore=all suppresses 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 all &&
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 test_done