t4135-*.sh: Skip the "backslash" tests on cygwin
[git/dscho.git] / t / t7508-status.sh
blobb73ab42936a8ea10dcdf40a6ad8b83d4a1d10056
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
412 cat >expect <<\EOF
413 # On branch master
414 # Changes to be committed:
415 # (use "git reset HEAD <file>..." to unstage)
417 # <GREEN>new file: dir2/added<RESET>
419 # Changes not staged for commit:
420 # (use "git add <file>..." to update what will be committed)
421 # (use "git checkout -- <file>..." to discard changes in working directory)
423 # <RED>modified: dir1/modified<RESET>
425 # Untracked files:
426 # (use "git add <file>..." to include in what will be committed)
428 # <BLUE>dir1/untracked<RESET>
429 # <BLUE>dir2/modified<RESET>
430 # <BLUE>dir2/untracked<RESET>
431 # <BLUE>expect<RESET>
432 # <BLUE>output<RESET>
433 # <BLUE>untracked<RESET>
436 test_expect_success 'status with color.ui' '
438 git config color.ui always &&
439 git status | test_decode_color >output &&
440 test_cmp expect output
444 test_expect_success 'status with color.status' '
446 git config --unset color.ui &&
447 git config color.status always &&
448 git status | test_decode_color >output &&
449 test_cmp expect output
453 cat >expect <<\EOF
454 <RED>M<RESET> dir1/modified
455 <GREEN>A<RESET> dir2/added
456 <BLUE>??<RESET> dir1/untracked
457 <BLUE>??<RESET> dir2/modified
458 <BLUE>??<RESET> dir2/untracked
459 <BLUE>??<RESET> expect
460 <BLUE>??<RESET> output
461 <BLUE>??<RESET> untracked
464 test_expect_success 'status -s with color.ui' '
466 git config --unset color.status &&
467 git config color.ui always &&
468 git status -s | test_decode_color >output &&
469 test_cmp expect output
473 test_expect_success 'status -s with color.status' '
475 git config --unset color.ui &&
476 git config color.status always &&
477 git status -s | test_decode_color >output &&
478 test_cmp expect output
482 cat >expect <<\EOF
483 ## <GREEN>master<RESET>
484 <RED>M<RESET> dir1/modified
485 <GREEN>A<RESET> dir2/added
486 <BLUE>??<RESET> dir1/untracked
487 <BLUE>??<RESET> dir2/modified
488 <BLUE>??<RESET> dir2/untracked
489 <BLUE>??<RESET> expect
490 <BLUE>??<RESET> output
491 <BLUE>??<RESET> untracked
494 test_expect_success 'status -s -b with color.status' '
496 git status -s -b | test_decode_color >output &&
497 test_cmp expect output
501 cat >expect <<\EOF
502 M dir1/modified
503 A dir2/added
504 ?? dir1/untracked
505 ?? dir2/modified
506 ?? dir2/untracked
507 ?? expect
508 ?? output
509 ?? untracked
512 test_expect_success 'status --porcelain ignores color.ui' '
514 git config --unset color.status &&
515 git config color.ui always &&
516 git status --porcelain | test_decode_color >output &&
517 test_cmp expect output
521 test_expect_success 'status --porcelain ignores color.status' '
523 git config --unset color.ui &&
524 git config color.status always &&
525 git status --porcelain | test_decode_color >output &&
526 test_cmp expect output
530 # recover unconditionally from color tests
531 git config --unset color.status
532 git config --unset color.ui
534 test_expect_success 'status --porcelain ignores -b' '
536 git status --porcelain -b >output &&
537 test_cmp expect output
541 cat >expect <<\EOF
542 # On branch master
543 # Changes to be committed:
544 # (use "git reset HEAD <file>..." to unstage)
546 # new file: dir2/added
548 # Changes not staged for commit:
549 # (use "git add <file>..." to update what will be committed)
550 # (use "git checkout -- <file>..." to discard changes in working directory)
552 # modified: dir1/modified
554 # Untracked files:
555 # (use "git add <file>..." to include in what will be committed)
557 # dir1/untracked
558 # dir2/modified
559 # dir2/untracked
560 # expect
561 # output
562 # untracked
566 test_expect_success 'status without relative paths' '
568 git config status.relativePaths false
569 (cd dir1 && git status) >output &&
570 test_cmp expect output
574 cat >expect <<\EOF
575 M dir1/modified
576 A dir2/added
577 ?? dir1/untracked
578 ?? dir2/modified
579 ?? dir2/untracked
580 ?? expect
581 ?? output
582 ?? untracked
585 test_expect_success 'status -s without relative paths' '
587 (cd dir1 && git status -s) >output &&
588 test_cmp expect output
592 cat <<EOF >expect
593 # On branch master
594 # Changes to be committed:
595 # (use "git reset HEAD <file>..." to unstage)
597 # modified: dir1/modified
599 # Untracked files:
600 # (use "git add <file>..." to include in what will be committed)
602 # dir1/untracked
603 # dir2/
604 # expect
605 # output
606 # untracked
608 test_expect_success 'dry-run of partial commit excluding new file in index' '
609 git commit --dry-run dir1/modified >output &&
610 test_cmp expect output
613 cat >expect <<EOF
614 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
616 test_expect_success 'status refreshes the index' '
617 touch dir2/added &&
618 git status &&
619 git diff-files >output &&
620 test_cmp expect output
623 test_expect_success 'setup status submodule summary' '
624 test_create_repo sm && (
625 cd sm &&
626 >foo &&
627 git add foo &&
628 git commit -m "Add foo"
629 ) &&
630 git add sm
633 cat >expect <<EOF
634 # On branch master
635 # Changes to be committed:
636 # (use "git reset HEAD <file>..." to unstage)
638 # new file: dir2/added
639 # new file: sm
641 # Changes not staged for commit:
642 # (use "git add <file>..." to update what will be committed)
643 # (use "git checkout -- <file>..." to discard changes in working directory)
645 # modified: dir1/modified
647 # Untracked files:
648 # (use "git add <file>..." to include in what will be committed)
650 # dir1/untracked
651 # dir2/modified
652 # dir2/untracked
653 # expect
654 # output
655 # untracked
657 test_expect_success 'status submodule summary is disabled by default' '
658 git status >output &&
659 test_cmp expect output
662 # we expect the same as the previous test
663 test_expect_success 'status --untracked-files=all does not show submodule' '
664 git status --untracked-files=all >output &&
665 test_cmp expect output
668 cat >expect <<EOF
669 M dir1/modified
670 A dir2/added
671 A sm
672 ?? dir1/untracked
673 ?? dir2/modified
674 ?? dir2/untracked
675 ?? expect
676 ?? output
677 ?? untracked
679 test_expect_success 'status -s submodule summary is disabled by default' '
680 git status -s >output &&
681 test_cmp expect output
684 # we expect the same as the previous test
685 test_expect_success 'status -s --untracked-files=all does not show submodule' '
686 git status -s --untracked-files=all >output &&
687 test_cmp expect output
690 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
692 cat >expect <<EOF
693 # On branch master
694 # Changes to be committed:
695 # (use "git reset HEAD <file>..." to unstage)
697 # new file: dir2/added
698 # new file: sm
700 # Changes not staged for commit:
701 # (use "git add <file>..." to update what will be committed)
702 # (use "git checkout -- <file>..." to discard changes in working directory)
704 # modified: dir1/modified
706 # Submodule changes to be committed:
708 # * sm 0000000...$head (1):
709 # > Add foo
711 # Untracked files:
712 # (use "git add <file>..." to include in what will be committed)
714 # dir1/untracked
715 # dir2/modified
716 # dir2/untracked
717 # expect
718 # output
719 # untracked
721 test_expect_success 'status submodule summary' '
722 git config status.submodulesummary 10 &&
723 git status >output &&
724 test_cmp expect output
727 cat >expect <<EOF
728 M dir1/modified
729 A dir2/added
730 A sm
731 ?? dir1/untracked
732 ?? dir2/modified
733 ?? dir2/untracked
734 ?? expect
735 ?? output
736 ?? untracked
738 test_expect_success 'status -s submodule summary' '
739 git status -s >output &&
740 test_cmp expect output
743 cat >expect <<EOF
744 # On branch master
745 # Changes not staged for commit:
746 # (use "git add <file>..." to update what will be committed)
747 # (use "git checkout -- <file>..." to discard changes in working directory)
749 # modified: dir1/modified
751 # Untracked files:
752 # (use "git add <file>..." to include in what will be committed)
754 # dir1/untracked
755 # dir2/modified
756 # dir2/untracked
757 # expect
758 # output
759 # untracked
760 no changes added to commit (use "git add" and/or "git commit -a")
762 test_expect_success 'status submodule summary (clean submodule)' '
763 git commit -m "commit submodule" &&
764 git config status.submodulesummary 10 &&
765 test_must_fail git commit --dry-run >output &&
766 test_cmp expect output &&
767 git status >output &&
768 test_cmp expect output
771 cat >expect <<EOF
772 M dir1/modified
773 ?? dir1/untracked
774 ?? dir2/modified
775 ?? dir2/untracked
776 ?? expect
777 ?? output
778 ?? untracked
780 test_expect_success 'status -s submodule summary (clean submodule)' '
781 git status -s >output &&
782 test_cmp expect output
785 cat >expect <<EOF
786 # On branch master
787 # Changes to be committed:
788 # (use "git reset HEAD^1 <file>..." to unstage)
790 # new file: dir2/added
791 # new file: sm
793 # Changes not staged for commit:
794 # (use "git add <file>..." to update what will be committed)
795 # (use "git checkout -- <file>..." to discard changes in working directory)
797 # modified: dir1/modified
799 # Submodule changes to be committed:
801 # * sm 0000000...$head (1):
802 # > Add foo
804 # Untracked files:
805 # (use "git add <file>..." to include in what will be committed)
807 # dir1/untracked
808 # dir2/modified
809 # dir2/untracked
810 # expect
811 # output
812 # untracked
814 test_expect_success 'commit --dry-run submodule summary (--amend)' '
815 git config status.submodulesummary 10 &&
816 git commit --dry-run --amend >output &&
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') && 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 # Changes not staged for commit:
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 # Changes not staged for commit:
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 # Changes not staged for commit:
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 # Changes not staged for commit:
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