Git.pm: Use stream-like writing in cat_blob()
[git/dscho.git] / t / t7508-status.sh
blobbd1c3773191267d1200c94e94cffb9b7c573141b
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 C_LOCALE_OUTPUT '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 C_LOCALE_OUTPUT '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 C_LOCALE_OUTPUT '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 test_expect_success 'setup dir3' '
161 mkdir dir3 &&
162 : >dir3/untracked1 &&
163 : >dir3/untracked2
166 cat >expect <<EOF
167 # On branch master
168 # Changes to be committed:
169 # (use "git reset HEAD <file>..." to unstage)
171 # new file: dir2/added
173 # Changes not staged for commit:
174 # (use "git add <file>..." to update what will be committed)
175 # (use "git checkout -- <file>..." to discard changes in working directory)
177 # modified: dir1/modified
179 # Untracked files not listed (use -u option to show untracked files)
181 test_expect_success C_LOCALE_OUTPUT 'status -uno' '
182 git status -uno >output &&
183 test_cmp expect output
186 test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' '
187 git config status.showuntrackedfiles no
188 test_when_finished "git config --unset status.showuntrackedfiles" &&
189 git status >output &&
190 test_cmp expect output
193 cat >expect <<EOF
194 # On branch master
195 # Changes to be committed:
196 # new file: dir2/added
198 # Changes not staged for commit:
199 # modified: dir1/modified
201 # Untracked files not listed
203 git config advice.statusHints false
204 test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' '
205 git status -uno >output &&
206 test_cmp expect output
208 git config --unset advice.statusHints
210 cat >expect << EOF
211 M dir1/modified
212 A dir2/added
214 test_expect_success 'status -s -uno' '
215 git status -s -uno >output &&
216 test_cmp expect output
219 test_expect_success 'status -s (status.showUntrackedFiles no)' '
220 git config status.showuntrackedfiles no
221 git status -s >output &&
222 test_cmp expect output
225 cat >expect <<EOF
226 # On branch master
227 # Changes to be committed:
228 # (use "git reset HEAD <file>..." to unstage)
230 # new file: dir2/added
232 # Changes not staged for commit:
233 # (use "git add <file>..." to update what will be committed)
234 # (use "git checkout -- <file>..." to discard changes in working directory)
236 # modified: dir1/modified
238 # Untracked files:
239 # (use "git add <file>..." to include in what will be committed)
241 # dir1/untracked
242 # dir2/modified
243 # dir2/untracked
244 # dir3/
245 # expect
246 # output
247 # untracked
249 test_expect_success C_LOCALE_OUTPUT 'status -unormal' '
250 git status -unormal >output &&
251 test_cmp expect output
254 test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' '
255 git config status.showuntrackedfiles normal
256 test_when_finished "git config --unset status.showuntrackedfiles" &&
257 git status >output &&
258 test_cmp expect output
261 cat >expect <<EOF
262 M dir1/modified
263 A dir2/added
264 ?? dir1/untracked
265 ?? dir2/modified
266 ?? dir2/untracked
267 ?? dir3/
268 ?? expect
269 ?? output
270 ?? untracked
272 test_expect_success 'status -s -unormal' '
273 git status -s -unormal >output &&
274 test_cmp expect output
277 test_expect_success 'status -s (status.showUntrackedFiles normal)' '
278 git config status.showuntrackedfiles normal
279 git status -s >output &&
280 test_cmp expect output
283 cat >expect <<EOF
284 # On branch master
285 # Changes to be committed:
286 # (use "git reset HEAD <file>..." to unstage)
288 # new file: dir2/added
290 # Changes not staged for commit:
291 # (use "git add <file>..." to update what will be committed)
292 # (use "git checkout -- <file>..." to discard changes in working directory)
294 # modified: dir1/modified
296 # Untracked files:
297 # (use "git add <file>..." to include in what will be committed)
299 # dir1/untracked
300 # dir2/modified
301 # dir2/untracked
302 # dir3/untracked1
303 # dir3/untracked2
304 # expect
305 # output
306 # untracked
308 test_expect_success C_LOCALE_OUTPUT 'status -uall' '
309 git status -uall >output &&
310 test_cmp expect output
312 test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' '
313 git config status.showuntrackedfiles all
314 test_when_finished "git config --unset status.showuntrackedfiles" &&
315 git status >output &&
316 test_cmp expect output
319 test_expect_success 'teardown dir3' '
320 rm -rf dir3
323 cat >expect <<EOF
324 M dir1/modified
325 A dir2/added
326 ?? dir1/untracked
327 ?? dir2/modified
328 ?? dir2/untracked
329 ?? expect
330 ?? output
331 ?? untracked
333 test_expect_success 'status -s -uall' '
334 git config --unset status.showuntrackedfiles
335 git status -s -uall >output &&
336 test_cmp expect output
338 test_expect_success 'status -s (status.showUntrackedFiles all)' '
339 git config status.showuntrackedfiles all
340 git status -s >output &&
341 rm -rf dir3 &&
342 git config --unset status.showuntrackedfiles &&
343 test_cmp expect output
346 cat >expect <<\EOF
347 # On branch master
348 # Changes to be committed:
349 # (use "git reset HEAD <file>..." to unstage)
351 # new file: ../dir2/added
353 # Changes not staged for commit:
354 # (use "git add <file>..." to update what will be committed)
355 # (use "git checkout -- <file>..." to discard changes in working directory)
357 # modified: modified
359 # Untracked files:
360 # (use "git add <file>..." to include in what will be committed)
362 # untracked
363 # ../dir2/modified
364 # ../dir2/untracked
365 # ../expect
366 # ../output
367 # ../untracked
370 test_expect_success C_LOCALE_OUTPUT 'status with relative paths' '
372 (cd dir1 && git status) >output &&
373 test_cmp expect output
377 cat >expect <<\EOF
378 M modified
379 A ../dir2/added
380 ?? untracked
381 ?? ../dir2/modified
382 ?? ../dir2/untracked
383 ?? ../expect
384 ?? ../output
385 ?? ../untracked
387 test_expect_success 'status -s with relative paths' '
389 (cd dir1 && git status -s) >output &&
390 test_cmp expect output
394 cat >expect <<\EOF
395 M dir1/modified
396 A dir2/added
397 ?? dir1/untracked
398 ?? dir2/modified
399 ?? dir2/untracked
400 ?? expect
401 ?? output
402 ?? untracked
405 test_expect_success 'status --porcelain ignores relative paths setting' '
407 (cd dir1 && git status --porcelain) >output &&
408 test_cmp expect output
412 test_expect_success 'setup unique colors' '
414 git config status.color.untracked blue &&
415 git config status.color.branch green
419 cat >expect <<\EOF
420 # On branch <GREEN>master<RESET>
421 # Changes to be committed:
422 # (use "git reset HEAD <file>..." to unstage)
424 # <GREEN>new file: dir2/added<RESET>
426 # Changes not staged for commit:
427 # (use "git add <file>..." to update what will be committed)
428 # (use "git checkout -- <file>..." to discard changes in working directory)
430 # <RED>modified: dir1/modified<RESET>
432 # Untracked files:
433 # (use "git add <file>..." to include in what will be committed)
435 # <BLUE>dir1/untracked<RESET>
436 # <BLUE>dir2/modified<RESET>
437 # <BLUE>dir2/untracked<RESET>
438 # <BLUE>expect<RESET>
439 # <BLUE>output<RESET>
440 # <BLUE>untracked<RESET>
443 test_expect_success C_LOCALE_OUTPUT 'status with color.ui' '
445 git config color.ui always &&
446 test_when_finished "git config --unset color.ui" &&
447 git status | test_decode_color >output &&
448 test_cmp expect output
452 test_expect_success C_LOCALE_OUTPUT 'status with color.status' '
454 git config color.status always &&
455 test_when_finished "git config --unset color.status" &&
456 git status | test_decode_color >output &&
457 test_cmp expect output
461 cat >expect <<\EOF
462 <RED>M<RESET> dir1/modified
463 <GREEN>A<RESET> dir2/added
464 <BLUE>??<RESET> dir1/untracked
465 <BLUE>??<RESET> dir2/modified
466 <BLUE>??<RESET> dir2/untracked
467 <BLUE>??<RESET> expect
468 <BLUE>??<RESET> output
469 <BLUE>??<RESET> untracked
472 test_expect_success 'status -s with color.ui' '
474 git config color.ui always &&
475 git status -s | test_decode_color >output &&
476 test_cmp expect output
480 test_expect_success 'status -s with color.status' '
482 git config --unset color.ui &&
483 git config color.status always &&
484 git status -s | test_decode_color >output &&
485 test_cmp expect output
489 cat >expect <<\EOF
490 ## <GREEN>master<RESET>
491 <RED>M<RESET> dir1/modified
492 <GREEN>A<RESET> dir2/added
493 <BLUE>??<RESET> dir1/untracked
494 <BLUE>??<RESET> dir2/modified
495 <BLUE>??<RESET> dir2/untracked
496 <BLUE>??<RESET> expect
497 <BLUE>??<RESET> output
498 <BLUE>??<RESET> untracked
501 test_expect_success 'status -s -b with color.status' '
503 git status -s -b | test_decode_color >output &&
504 test_cmp expect output
508 cat >expect <<\EOF
509 M dir1/modified
510 A dir2/added
511 ?? dir1/untracked
512 ?? dir2/modified
513 ?? dir2/untracked
514 ?? expect
515 ?? output
516 ?? untracked
519 test_expect_success 'status --porcelain ignores color.ui' '
521 git config --unset color.status &&
522 git config color.ui always &&
523 git status --porcelain | test_decode_color >output &&
524 test_cmp expect output
528 test_expect_success 'status --porcelain ignores color.status' '
530 git config --unset color.ui &&
531 git config color.status always &&
532 git status --porcelain | test_decode_color >output &&
533 test_cmp expect output
537 # recover unconditionally from color tests
538 git config --unset color.status
539 git config --unset color.ui
541 test_expect_success 'status --porcelain ignores -b' '
543 git status --porcelain -b >output &&
544 test_cmp expect output
548 cat >expect <<\EOF
549 # On branch master
550 # Changes to be committed:
551 # (use "git reset HEAD <file>..." to unstage)
553 # new file: dir2/added
555 # Changes not staged for commit:
556 # (use "git add <file>..." to update what will be committed)
557 # (use "git checkout -- <file>..." to discard changes in working directory)
559 # modified: dir1/modified
561 # Untracked files:
562 # (use "git add <file>..." to include in what will be committed)
564 # dir1/untracked
565 # dir2/modified
566 # dir2/untracked
567 # expect
568 # output
569 # untracked
573 test_expect_success C_LOCALE_OUTPUT 'status without relative paths' '
575 git config status.relativePaths false &&
576 test_when_finished "git config --unset status.relativePaths" &&
577 (cd dir1 && git status) >output &&
578 test_cmp expect output
582 cat >expect <<\EOF
583 M dir1/modified
584 A dir2/added
585 ?? dir1/untracked
586 ?? dir2/modified
587 ?? dir2/untracked
588 ?? expect
589 ?? output
590 ?? untracked
593 test_expect_success 'status -s without relative paths' '
595 git config status.relativePaths false &&
596 test_when_finished "git config --unset status.relativePaths" &&
597 (cd dir1 && git status -s) >output &&
598 test_cmp expect output
602 cat <<EOF >expect
603 # On branch master
604 # Changes to be committed:
605 # (use "git reset HEAD <file>..." to unstage)
607 # modified: dir1/modified
609 # Untracked files:
610 # (use "git add <file>..." to include in what will be committed)
612 # dir1/untracked
613 # dir2/
614 # expect
615 # output
616 # untracked
618 test_expect_success 'dry-run of partial commit excluding new file in index' '
619 git commit --dry-run dir1/modified >output
622 test_expect_success C_LOCALE_OUTPUT 'dry-run of partial commit excluding new file in index: output' '
623 test_cmp expect output
626 cat >expect <<EOF
627 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
629 test_expect_success 'status refreshes the index' '
630 touch dir2/added &&
631 git status &&
632 git diff-files >output &&
633 test_cmp expect output
636 test_expect_success 'setup status submodule summary' '
637 test_create_repo sm && (
638 cd sm &&
639 >foo &&
640 git add foo &&
641 git commit -m "Add foo"
642 ) &&
643 git add sm
646 cat >expect <<EOF
647 # On branch master
648 # Changes to be committed:
649 # (use "git reset HEAD <file>..." to unstage)
651 # new file: dir2/added
652 # new file: sm
654 # Changes not staged for commit:
655 # (use "git add <file>..." to update what will be committed)
656 # (use "git checkout -- <file>..." to discard changes in working directory)
658 # modified: dir1/modified
660 # Untracked files:
661 # (use "git add <file>..." to include in what will be committed)
663 # dir1/untracked
664 # dir2/modified
665 # dir2/untracked
666 # expect
667 # output
668 # untracked
670 test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' '
671 git status >output &&
672 test_cmp expect output
675 # we expect the same as the previous test
676 test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' '
677 git status --untracked-files=all >output &&
678 test_cmp expect output
681 cat >expect <<EOF
682 M dir1/modified
683 A dir2/added
684 A sm
685 ?? dir1/untracked
686 ?? dir2/modified
687 ?? dir2/untracked
688 ?? expect
689 ?? output
690 ?? untracked
692 test_expect_success 'status -s submodule summary is disabled by default' '
693 git status -s >output &&
694 test_cmp expect output
697 # we expect the same as the previous test
698 test_expect_success 'status -s --untracked-files=all does not show submodule' '
699 git status -s --untracked-files=all >output &&
700 test_cmp expect output
703 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
705 cat >expect <<EOF
706 # On branch master
707 # Changes to be committed:
708 # (use "git reset HEAD <file>..." to unstage)
710 # new file: dir2/added
711 # new file: sm
713 # Changes not staged for commit:
714 # (use "git add <file>..." to update what will be committed)
715 # (use "git checkout -- <file>..." to discard changes in working directory)
717 # modified: dir1/modified
719 # Submodule changes to be committed:
721 # * sm 0000000...$head (1):
722 # > Add foo
724 # Untracked files:
725 # (use "git add <file>..." to include in what will be committed)
727 # dir1/untracked
728 # dir2/modified
729 # dir2/untracked
730 # expect
731 # output
732 # untracked
734 test_expect_success C_LOCALE_OUTPUT 'status submodule summary' '
735 git config status.submodulesummary 10 &&
736 git status >output &&
737 if test_have_prereq MINGW
738 then
739 dos2unix output
740 fi &&
741 test_cmp expect output
744 cat >expect <<EOF
745 M dir1/modified
746 A dir2/added
747 A sm
748 ?? dir1/untracked
749 ?? dir2/modified
750 ?? dir2/untracked
751 ?? expect
752 ?? output
753 ?? untracked
755 test_expect_success 'status -s submodule summary' '
756 git status -s >output &&
757 if test_have_prereq MINGW
758 then
759 dos2unix output
760 fi &&
761 test_cmp expect output
764 cat >expect <<EOF
765 # On branch master
766 # Changes not staged for commit:
767 # (use "git add <file>..." to update what will be committed)
768 # (use "git checkout -- <file>..." to discard changes in working directory)
770 # modified: dir1/modified
772 # Untracked files:
773 # (use "git add <file>..." to include in what will be committed)
775 # dir1/untracked
776 # dir2/modified
777 # dir2/untracked
778 # expect
779 # output
780 # untracked
781 no changes added to commit (use "git add" and/or "git commit -a")
783 test_expect_success 'status submodule summary (clean submodule): commit' '
784 git commit -m "commit submodule"
787 test_expect_success C_LOCALE_OUTPUT 'status submodule summary (clean submodule): output' '
788 git config status.submodulesummary 10 &&
789 test_must_fail git commit --dry-run >output &&
790 if test_have_prereq MINGW
791 then
792 dos2unix output
793 fi &&
794 test_cmp expect output &&
795 git status >output &&
796 if test_have_prereq MINGW
797 then
798 dos2unix output
799 fi &&
800 test_cmp expect output
803 cat >expect <<EOF
804 M dir1/modified
805 ?? dir1/untracked
806 ?? dir2/modified
807 ?? dir2/untracked
808 ?? expect
809 ?? output
810 ?? untracked
812 test_expect_success 'status -s submodule summary (clean submodule)' '
813 git status -s >output &&
814 if test_have_prereq MINGW
815 then
816 dos2unix output
817 fi &&
818 test_cmp expect output
821 cat >expect <<EOF
822 # On branch master
823 # Changes to be committed:
824 # (use "git reset HEAD^1 <file>..." to unstage)
826 # new file: dir2/added
827 # new file: sm
829 # Changes not staged for commit:
830 # (use "git add <file>..." to update what will be committed)
831 # (use "git checkout -- <file>..." to discard changes in working directory)
833 # modified: dir1/modified
835 # Submodule changes to be committed:
837 # * sm 0000000...$head (1):
838 # > Add foo
840 # Untracked files:
841 # (use "git add <file>..." to include in what will be committed)
843 # dir1/untracked
844 # dir2/modified
845 # dir2/untracked
846 # expect
847 # output
848 # untracked
850 test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' '
851 git config status.submodulesummary 10 &&
852 git commit --dry-run --amend >output &&
853 if test_have_prereq MINGW
854 then
855 dos2unix output
856 fi &&
857 test_cmp expect output
860 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
862 chmod a-w .git &&
863 # make dir1/tracked stat-dirty
864 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
865 git status -s >output &&
866 ! grep dir1/tracked output &&
867 # make sure "status" succeeded without writing index out
868 git diff-files | grep dir1/tracked
870 status=$?
871 chmod 775 .git
872 (exit $status)
875 (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
876 new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
877 touch .gitmodules
879 cat > expect << EOF
880 # On branch master
881 # Changes to be committed:
882 # (use "git reset HEAD <file>..." to unstage)
884 # modified: sm
886 # Changes not staged for commit:
887 # (use "git add <file>..." to update what will be committed)
888 # (use "git checkout -- <file>..." to discard changes in working directory)
890 # modified: dir1/modified
892 # Submodule changes to be committed:
894 # * sm $head...$new_head (1):
895 # > Add bar
897 # Untracked files:
898 # (use "git add <file>..." to include in what will be committed)
900 # .gitmodules
901 # dir1/untracked
902 # dir2/modified
903 # dir2/untracked
904 # expect
905 # output
906 # untracked
909 test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=untracked suppresses submodules with untracked content' '
910 echo modified > sm/untracked &&
911 git status --ignore-submodules=untracked > output &&
912 test_cmp expect output
915 test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' '
916 git config diff.ignoreSubmodules dirty &&
917 git status >output &&
918 test_cmp expect output &&
919 git config --add -f .gitmodules submodule.subname.ignore untracked &&
920 git config --add -f .gitmodules submodule.subname.path sm &&
921 git status > output &&
922 test_cmp expect output &&
923 git config -f .gitmodules --remove-section submodule.subname &&
924 git config --unset diff.ignoreSubmodules
927 test_expect_success C_LOCALE_OUTPUT '.git/config ignore=untracked suppresses submodules with untracked content' '
928 git config --add -f .gitmodules submodule.subname.ignore none &&
929 git config --add -f .gitmodules submodule.subname.path sm &&
930 git config --add submodule.subname.ignore untracked &&
931 git config --add submodule.subname.path sm &&
932 git status > output &&
933 test_cmp expect output &&
934 git config --remove-section submodule.subname &&
935 git config --remove-section -f .gitmodules submodule.subname
938 test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with untracked content' '
939 git status --ignore-submodules=dirty > output &&
940 test_cmp expect output
943 test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' '
944 git config diff.ignoreSubmodules dirty &&
945 git status >output &&
946 ! test -s actual &&
947 git config --add -f .gitmodules submodule.subname.ignore dirty &&
948 git config --add -f .gitmodules submodule.subname.path sm &&
949 git status > output &&
950 test_cmp expect output &&
951 git config -f .gitmodules --remove-section submodule.subname &&
952 git config --unset diff.ignoreSubmodules
955 test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with untracked content' '
956 git config --add -f .gitmodules submodule.subname.ignore none &&
957 git config --add -f .gitmodules submodule.subname.path sm &&
958 git config --add submodule.subname.ignore dirty &&
959 git config --add submodule.subname.path sm &&
960 git status > output &&
961 test_cmp expect output &&
962 git config --remove-section submodule.subname &&
963 git config -f .gitmodules --remove-section submodule.subname
966 test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with modified content' '
967 echo modified > sm/foo &&
968 git status --ignore-submodules=dirty > output &&
969 test_cmp expect output
972 test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with modified content' '
973 git config --add -f .gitmodules submodule.subname.ignore dirty &&
974 git config --add -f .gitmodules submodule.subname.path sm &&
975 git status > output &&
976 test_cmp expect output &&
977 git config -f .gitmodules --remove-section submodule.subname
980 test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with modified content' '
981 git config --add -f .gitmodules submodule.subname.ignore none &&
982 git config --add -f .gitmodules submodule.subname.path sm &&
983 git config --add submodule.subname.ignore dirty &&
984 git config --add submodule.subname.path sm &&
985 git status > output &&
986 test_cmp expect output &&
987 git config --remove-section submodule.subname &&
988 git config -f .gitmodules --remove-section submodule.subname
991 cat > expect << EOF
992 # On branch master
993 # Changes to be committed:
994 # (use "git reset HEAD <file>..." to unstage)
996 # modified: sm
998 # Changes not staged for commit:
999 # (use "git add <file>..." to update what will be committed)
1000 # (use "git checkout -- <file>..." to discard changes in working directory)
1001 # (commit or discard the untracked or modified content in submodules)
1003 # modified: dir1/modified
1004 # modified: sm (modified content)
1006 # Submodule changes to be committed:
1008 # * sm $head...$new_head (1):
1009 # > Add bar
1011 # Untracked files:
1012 # (use "git add <file>..." to include in what will be committed)
1014 # .gitmodules
1015 # dir1/untracked
1016 # dir2/modified
1017 # dir2/untracked
1018 # expect
1019 # output
1020 # untracked
1023 test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1024 git status --ignore-submodules=untracked > output &&
1025 test_cmp expect output
1028 test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1029 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1030 git config --add -f .gitmodules submodule.subname.path sm &&
1031 git status > output &&
1032 test_cmp expect output &&
1033 git config -f .gitmodules --remove-section submodule.subname
1036 test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodules with modified content" '
1037 git config --add -f .gitmodules submodule.subname.ignore none &&
1038 git config --add -f .gitmodules submodule.subname.path sm &&
1039 git config --add submodule.subname.ignore untracked &&
1040 git config --add submodule.subname.path sm &&
1041 git status > output &&
1042 test_cmp expect output &&
1043 git config --remove-section submodule.subname &&
1044 git config -f .gitmodules --remove-section submodule.subname
1047 head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
1049 cat > expect << EOF
1050 # On branch master
1051 # Changes to be committed:
1052 # (use "git reset HEAD <file>..." to unstage)
1054 # modified: sm
1056 # Changes not staged for commit:
1057 # (use "git add <file>..." to update what will be committed)
1058 # (use "git checkout -- <file>..." to discard changes in working directory)
1060 # modified: dir1/modified
1061 # modified: sm (new commits)
1063 # Submodule changes to be committed:
1065 # * sm $head...$new_head (1):
1066 # > Add bar
1068 # Submodules changed but not updated:
1070 # * sm $new_head...$head2 (1):
1071 # > 2nd commit
1073 # Untracked files:
1074 # (use "git add <file>..." to include in what will be committed)
1076 # .gitmodules
1077 # dir1/untracked
1078 # dir2/modified
1079 # dir2/untracked
1080 # expect
1081 # output
1082 # untracked
1085 test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" '
1086 git status --ignore-submodules=untracked > output &&
1087 test_cmp expect output
1090 test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1091 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1092 git config --add -f .gitmodules submodule.subname.path sm &&
1093 git status > output &&
1094 test_cmp expect output &&
1095 git config -f .gitmodules --remove-section submodule.subname
1098 test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodule summary" '
1099 git config --add -f .gitmodules submodule.subname.ignore none &&
1100 git config --add -f .gitmodules submodule.subname.path sm &&
1101 git config --add submodule.subname.ignore untracked &&
1102 git config --add submodule.subname.path sm &&
1103 git status > output &&
1104 test_cmp expect output &&
1105 git config --remove-section submodule.subname &&
1106 git config -f .gitmodules --remove-section submodule.subname
1109 test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" '
1110 git status --ignore-submodules=dirty > output &&
1111 test_cmp expect output
1113 test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1114 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1115 git config --add -f .gitmodules submodule.subname.path sm &&
1116 git status > output &&
1117 test_cmp expect output &&
1118 git config -f .gitmodules --remove-section submodule.subname
1121 test_expect_success C_LOCALE_OUTPUT ".git/config ignore=dirty doesn't suppress submodule summary" '
1122 git config --add -f .gitmodules submodule.subname.ignore none &&
1123 git config --add -f .gitmodules submodule.subname.path sm &&
1124 git config --add submodule.subname.ignore dirty &&
1125 git config --add submodule.subname.path sm &&
1126 git status > output &&
1127 test_cmp expect output &&
1128 git config --remove-section submodule.subname &&
1129 git config -f .gitmodules --remove-section submodule.subname
1132 cat > expect << EOF
1133 # On branch master
1134 # Changes not staged for commit:
1135 # (use "git add <file>..." to update what will be committed)
1136 # (use "git checkout -- <file>..." to discard changes in working directory)
1138 # modified: dir1/modified
1140 # Untracked files:
1141 # (use "git add <file>..." to include in what will be committed)
1143 # .gitmodules
1144 # dir1/untracked
1145 # dir2/modified
1146 # dir2/untracked
1147 # expect
1148 # output
1149 # untracked
1150 no changes added to commit (use "git add" and/or "git commit -a")
1153 test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" '
1154 git status --ignore-submodules=all > output &&
1155 test_cmp expect output
1158 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1159 git config --add -f .gitmodules submodule.subname.ignore all &&
1160 git config --add -f .gitmodules submodule.subname.path sm &&
1161 git status > output &&
1162 test_cmp expect output &&
1163 git config -f .gitmodules --remove-section submodule.subname
1166 test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1167 git config --add -f .gitmodules submodule.subname.ignore none &&
1168 git config --add -f .gitmodules submodule.subname.path sm &&
1169 git config --add submodule.subname.ignore all &&
1170 git config --add submodule.subname.path sm &&
1171 git status > output &&
1172 test_cmp expect output &&
1173 git config --remove-section submodule.subname &&
1174 git config -f .gitmodules --remove-section submodule.subname
1177 test_done