t030[02]: work around CR/LF issue
[git/dscho.git] / t / t7508-status.sh
blobfc57b135c50e34ab86c04d0a0ec81052ce40f8ff
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 test_i18ngrep "[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 test_i18ngrep "[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)' '
59 test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
62 cat >expect <<\EOF
63 # On branch master
64 # Changes to be committed:
65 # (use "git reset HEAD <file>..." to unstage)
67 # new file: dir2/added
69 # Changes not staged for commit:
70 # (use "git add <file>..." to update what will be committed)
71 # (use "git checkout -- <file>..." to discard changes in working directory)
73 # modified: dir1/modified
75 # Untracked files:
76 # (use "git add <file>..." to include in what will be committed)
78 # dir1/untracked
79 # dir2/modified
80 # dir2/untracked
81 # expect
82 # output
83 # untracked
84 EOF
86 test_expect_success 'status (2)' '
87 git status >output &&
88 test_i18ncmp expect output
91 cat >expect <<\EOF
92 # On branch master
93 # Changes to be committed:
94 # new file: dir2/added
96 # Changes not staged for commit:
97 # modified: dir1/modified
99 # Untracked files:
100 # dir1/untracked
101 # dir2/modified
102 # dir2/untracked
103 # expect
104 # output
105 # untracked
108 test_expect_success 'status (advice.statusHints false)' '
109 test_when_finished "git config --unset advice.statusHints" &&
110 git config advice.statusHints false &&
111 git status >output &&
112 test_i18ncmp expect output
116 cat >expect <<\EOF
117 M dir1/modified
118 A dir2/added
119 ?? dir1/untracked
120 ?? dir2/modified
121 ?? dir2/untracked
122 ?? expect
123 ?? output
124 ?? untracked
127 test_expect_success 'status -s' '
129 git status -s >output &&
130 test_cmp expect output
134 test_expect_success 'status with gitignore' '
136 echo ".gitignore" &&
137 echo "expect" &&
138 echo "output" &&
139 echo "untracked"
140 } >.gitignore &&
142 cat >expect <<-\EOF &&
143 M dir1/modified
144 A dir2/added
145 ?? dir2/modified
147 git status -s >output &&
148 test_cmp expect output &&
150 cat >expect <<-\EOF &&
151 M dir1/modified
152 A dir2/added
153 ?? dir2/modified
154 !! .gitignore
155 !! dir1/untracked
156 !! dir2/untracked
157 !! expect
158 !! output
159 !! untracked
161 git status -s --ignored >output &&
162 test_cmp expect output &&
164 cat >expect <<-\EOF &&
165 # On branch master
166 # Changes to be committed:
167 # (use "git reset HEAD <file>..." to unstage)
169 # new file: dir2/added
171 # Changes not staged for commit:
172 # (use "git add <file>..." to update what will be committed)
173 # (use "git checkout -- <file>..." to discard changes in working directory)
175 # modified: dir1/modified
177 # Untracked files:
178 # (use "git add <file>..." to include in what will be committed)
180 # dir2/modified
181 # Ignored files:
182 # (use "git add -f <file>..." to include in what will be committed)
184 # .gitignore
185 # dir1/untracked
186 # dir2/untracked
187 # expect
188 # output
189 # untracked
191 git status --ignored >output &&
192 test_i18ncmp expect output
195 test_expect_success 'status with gitignore (nothing untracked)' '
197 echo ".gitignore" &&
198 echo "expect" &&
199 echo "dir2/modified" &&
200 echo "output" &&
201 echo "untracked"
202 } >.gitignore &&
204 cat >expect <<-\EOF &&
205 M dir1/modified
206 A dir2/added
208 git status -s >output &&
209 test_cmp expect output &&
211 cat >expect <<-\EOF &&
212 M dir1/modified
213 A dir2/added
214 !! .gitignore
215 !! dir1/untracked
216 !! dir2/modified
217 !! dir2/untracked
218 !! expect
219 !! output
220 !! untracked
222 git status -s --ignored >output &&
223 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 # Ignored files:
239 # (use "git add -f <file>..." to include in what will be committed)
241 # .gitignore
242 # dir1/untracked
243 # dir2/modified
244 # dir2/untracked
245 # expect
246 # output
247 # untracked
249 git status --ignored >output &&
250 test_i18ncmp expect output
253 rm -f .gitignore
255 cat >expect <<\EOF
256 ## master
257 M dir1/modified
258 A dir2/added
259 ?? dir1/untracked
260 ?? dir2/modified
261 ?? dir2/untracked
262 ?? expect
263 ?? output
264 ?? untracked
267 test_expect_success 'status -s -b' '
269 git status -s -b >output &&
270 test_cmp expect output
274 test_expect_success 'setup dir3' '
275 mkdir dir3 &&
276 : >dir3/untracked1 &&
277 : >dir3/untracked2
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 not listed (use -u option to show untracked files)
295 test_expect_success 'status -uno' '
296 git status -uno >output &&
297 test_i18ncmp expect output
300 test_expect_success 'status (status.showUntrackedFiles no)' '
301 git config status.showuntrackedfiles no
302 test_when_finished "git config --unset status.showuntrackedfiles" &&
303 git status >output &&
304 test_i18ncmp expect output
307 cat >expect <<EOF
308 # On branch master
309 # Changes to be committed:
310 # new file: dir2/added
312 # Changes not staged for commit:
313 # modified: dir1/modified
315 # Untracked files not listed
317 git config advice.statusHints false
318 test_expect_success 'status -uno (advice.statusHints false)' '
319 git status -uno >output &&
320 test_i18ncmp expect output
322 git config --unset advice.statusHints
324 cat >expect << EOF
325 M dir1/modified
326 A dir2/added
328 test_expect_success 'status -s -uno' '
329 git status -s -uno >output &&
330 test_cmp expect output
333 test_expect_success 'status -s (status.showUntrackedFiles no)' '
334 git config status.showuntrackedfiles no
335 git status -s >output &&
336 test_cmp expect output
339 cat >expect <<EOF
340 # On branch master
341 # Changes to be committed:
342 # (use "git reset HEAD <file>..." to unstage)
344 # new file: dir2/added
346 # Changes not staged for commit:
347 # (use "git add <file>..." to update what will be committed)
348 # (use "git checkout -- <file>..." to discard changes in working directory)
350 # modified: dir1/modified
352 # Untracked files:
353 # (use "git add <file>..." to include in what will be committed)
355 # dir1/untracked
356 # dir2/modified
357 # dir2/untracked
358 # dir3/
359 # expect
360 # output
361 # untracked
363 test_expect_success 'status -unormal' '
364 git status -unormal >output &&
365 test_i18ncmp expect output
368 test_expect_success 'status (status.showUntrackedFiles normal)' '
369 git config status.showuntrackedfiles normal
370 test_when_finished "git config --unset status.showuntrackedfiles" &&
371 git status >output &&
372 test_i18ncmp expect output
375 cat >expect <<EOF
376 M dir1/modified
377 A dir2/added
378 ?? dir1/untracked
379 ?? dir2/modified
380 ?? dir2/untracked
381 ?? dir3/
382 ?? expect
383 ?? output
384 ?? untracked
386 test_expect_success 'status -s -unormal' '
387 git status -s -unormal >output &&
388 test_cmp expect output
391 test_expect_success 'status -s (status.showUntrackedFiles normal)' '
392 git config status.showuntrackedfiles normal
393 git status -s >output &&
394 test_cmp expect output
397 cat >expect <<EOF
398 # On branch master
399 # Changes to be committed:
400 # (use "git reset HEAD <file>..." to unstage)
402 # new file: dir2/added
404 # Changes not staged for commit:
405 # (use "git add <file>..." to update what will be committed)
406 # (use "git checkout -- <file>..." to discard changes in working directory)
408 # modified: dir1/modified
410 # Untracked files:
411 # (use "git add <file>..." to include in what will be committed)
413 # dir1/untracked
414 # dir2/modified
415 # dir2/untracked
416 # dir3/untracked1
417 # dir3/untracked2
418 # expect
419 # output
420 # untracked
422 test_expect_success 'status -uall' '
423 git status -uall >output &&
424 test_i18ncmp expect output
427 test_expect_success 'status (status.showUntrackedFiles all)' '
428 git config status.showuntrackedfiles all
429 test_when_finished "git config --unset status.showuntrackedfiles" &&
430 git status >output &&
431 test_i18ncmp expect output
434 test_expect_success 'teardown dir3' '
435 rm -rf dir3
438 cat >expect <<EOF
439 M dir1/modified
440 A dir2/added
441 ?? dir1/untracked
442 ?? dir2/modified
443 ?? dir2/untracked
444 ?? expect
445 ?? output
446 ?? untracked
448 test_expect_success 'status -s -uall' '
449 git config --unset status.showuntrackedfiles
450 git status -s -uall >output &&
451 test_cmp expect output
453 test_expect_success 'status -s (status.showUntrackedFiles all)' '
454 git config status.showuntrackedfiles all
455 git status -s >output &&
456 rm -rf dir3 &&
457 git config --unset status.showuntrackedfiles &&
458 test_cmp expect output
461 cat >expect <<\EOF
462 # On branch master
463 # Changes to be committed:
464 # (use "git reset HEAD <file>..." to unstage)
466 # new file: ../dir2/added
468 # Changes not staged for commit:
469 # (use "git add <file>..." to update what will be committed)
470 # (use "git checkout -- <file>..." to discard changes in working directory)
472 # modified: modified
474 # Untracked files:
475 # (use "git add <file>..." to include in what will be committed)
477 # untracked
478 # ../dir2/modified
479 # ../dir2/untracked
480 # ../expect
481 # ../output
482 # ../untracked
485 test_expect_success 'status with relative paths' '
486 (cd dir1 && git status) >output &&
487 test_i18ncmp expect output
490 cat >expect <<\EOF
491 M modified
492 A ../dir2/added
493 ?? untracked
494 ?? ../dir2/modified
495 ?? ../dir2/untracked
496 ?? ../expect
497 ?? ../output
498 ?? ../untracked
500 test_expect_success 'status -s with relative paths' '
502 (cd dir1 && git status -s) >output &&
503 test_cmp expect output
507 cat >expect <<\EOF
508 M dir1/modified
509 A dir2/added
510 ?? dir1/untracked
511 ?? dir2/modified
512 ?? dir2/untracked
513 ?? expect
514 ?? output
515 ?? untracked
518 test_expect_success 'status --porcelain ignores relative paths setting' '
520 (cd dir1 && git status --porcelain) >output &&
521 test_cmp expect output
525 test_expect_success 'setup unique colors' '
527 git config status.color.untracked blue &&
528 git config status.color.branch green
532 cat >expect <<\EOF
533 # On branch <GREEN>master<RESET>
534 # Changes to be committed:
535 # (use "git reset HEAD <file>..." to unstage)
537 # <GREEN>new file: dir2/added<RESET>
539 # Changes not staged for commit:
540 # (use "git add <file>..." to update what will be committed)
541 # (use "git checkout -- <file>..." to discard changes in working directory)
543 # <RED>modified: dir1/modified<RESET>
545 # Untracked files:
546 # (use "git add <file>..." to include in what will be committed)
548 # <BLUE>dir1/untracked<RESET>
549 # <BLUE>dir2/modified<RESET>
550 # <BLUE>dir2/untracked<RESET>
551 # <BLUE>expect<RESET>
552 # <BLUE>output<RESET>
553 # <BLUE>untracked<RESET>
556 test_expect_success 'status with color.ui' '
557 git config color.ui always &&
558 test_when_finished "git config --unset color.ui" &&
559 git status | test_decode_color >output &&
560 test_i18ncmp expect output
563 test_expect_success 'status with color.status' '
564 git config color.status always &&
565 test_when_finished "git config --unset color.status" &&
566 git status | test_decode_color >output &&
567 test_i18ncmp expect output
570 cat >expect <<\EOF
571 <RED>M<RESET> dir1/modified
572 <GREEN>A<RESET> dir2/added
573 <BLUE>??<RESET> dir1/untracked
574 <BLUE>??<RESET> dir2/modified
575 <BLUE>??<RESET> dir2/untracked
576 <BLUE>??<RESET> expect
577 <BLUE>??<RESET> output
578 <BLUE>??<RESET> untracked
581 test_expect_success 'status -s with color.ui' '
583 git config color.ui always &&
584 git status -s | test_decode_color >output &&
585 test_cmp expect output
589 test_expect_success 'status -s with color.status' '
591 git config --unset color.ui &&
592 git config color.status always &&
593 git status -s | test_decode_color >output &&
594 test_cmp expect output
598 cat >expect <<\EOF
599 ## <GREEN>master<RESET>
600 <RED>M<RESET> dir1/modified
601 <GREEN>A<RESET> dir2/added
602 <BLUE>??<RESET> dir1/untracked
603 <BLUE>??<RESET> dir2/modified
604 <BLUE>??<RESET> dir2/untracked
605 <BLUE>??<RESET> expect
606 <BLUE>??<RESET> output
607 <BLUE>??<RESET> untracked
610 test_expect_success 'status -s -b with color.status' '
612 git status -s -b | test_decode_color >output &&
613 test_cmp expect output
617 cat >expect <<\EOF
618 M dir1/modified
619 A dir2/added
620 ?? dir1/untracked
621 ?? dir2/modified
622 ?? dir2/untracked
623 ?? expect
624 ?? output
625 ?? untracked
628 test_expect_success 'status --porcelain ignores color.ui' '
630 git config --unset color.status &&
631 git config color.ui always &&
632 git status --porcelain | test_decode_color >output &&
633 test_cmp expect output
637 test_expect_success 'status --porcelain ignores color.status' '
639 git config --unset color.ui &&
640 git config color.status always &&
641 git status --porcelain | test_decode_color >output &&
642 test_cmp expect output
646 # recover unconditionally from color tests
647 git config --unset color.status
648 git config --unset color.ui
650 test_expect_success 'status --porcelain ignores -b' '
652 git status --porcelain -b >output &&
653 test_cmp expect output
657 cat >expect <<\EOF
658 # On branch master
659 # Changes to be committed:
660 # (use "git reset HEAD <file>..." to unstage)
662 # new file: dir2/added
664 # Changes not staged for commit:
665 # (use "git add <file>..." to update what will be committed)
666 # (use "git checkout -- <file>..." to discard changes in working directory)
668 # modified: dir1/modified
670 # Untracked files:
671 # (use "git add <file>..." to include in what will be committed)
673 # dir1/untracked
674 # dir2/modified
675 # dir2/untracked
676 # expect
677 # output
678 # untracked
682 test_expect_success 'status without relative paths' '
684 git config status.relativePaths false &&
685 test_when_finished "git config --unset status.relativePaths" &&
686 (cd dir1 && git status) >output &&
687 test_i18ncmp expect output
691 cat >expect <<\EOF
692 M dir1/modified
693 A dir2/added
694 ?? dir1/untracked
695 ?? dir2/modified
696 ?? dir2/untracked
697 ?? expect
698 ?? output
699 ?? untracked
702 test_expect_success 'status -s without relative paths' '
704 git config status.relativePaths false &&
705 test_when_finished "git config --unset status.relativePaths" &&
706 (cd dir1 && git status -s) >output &&
707 test_cmp expect output
711 cat <<EOF >expect
712 # On branch master
713 # Changes to be committed:
714 # (use "git reset HEAD <file>..." to unstage)
716 # modified: dir1/modified
718 # Untracked files:
719 # (use "git add <file>..." to include in what will be committed)
721 # dir1/untracked
722 # dir2/
723 # expect
724 # output
725 # untracked
727 test_expect_success 'dry-run of partial commit excluding new file in index' '
728 git commit --dry-run dir1/modified >output &&
729 test_i18ncmp expect output
732 cat >expect <<EOF
733 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
735 test_expect_success 'status refreshes the index' '
736 touch dir2/added &&
737 git status &&
738 git diff-files >output &&
739 test_cmp expect output
742 test_expect_success 'setup status submodule summary' '
743 test_create_repo sm && (
744 cd sm &&
745 >foo &&
746 git add foo &&
747 git commit -m "Add foo"
748 ) &&
749 git add sm
752 cat >expect <<EOF
753 # On branch master
754 # Changes to be committed:
755 # (use "git reset HEAD <file>..." to unstage)
757 # new file: dir2/added
758 # new file: sm
760 # Changes not staged for commit:
761 # (use "git add <file>..." to update what will be committed)
762 # (use "git checkout -- <file>..." to discard changes in working directory)
764 # modified: dir1/modified
766 # Untracked files:
767 # (use "git add <file>..." to include in what will be committed)
769 # dir1/untracked
770 # dir2/modified
771 # dir2/untracked
772 # expect
773 # output
774 # untracked
776 test_expect_success 'status submodule summary is disabled by default' '
777 git status >output &&
778 test_i18ncmp expect output
781 # we expect the same as the previous test
782 test_expect_success 'status --untracked-files=all does not show submodule' '
783 git status --untracked-files=all >output &&
784 test_i18ncmp expect output
787 cat >expect <<EOF
788 M dir1/modified
789 A dir2/added
790 A sm
791 ?? dir1/untracked
792 ?? dir2/modified
793 ?? dir2/untracked
794 ?? expect
795 ?? output
796 ?? untracked
798 test_expect_success 'status -s submodule summary is disabled by default' '
799 git status -s >output &&
800 test_cmp expect output
803 # we expect the same as the previous test
804 test_expect_success 'status -s --untracked-files=all does not show submodule' '
805 git status -s --untracked-files=all >output &&
806 test_cmp expect output
809 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
811 cat >expect <<EOF
812 # On branch master
813 # Changes to be committed:
814 # (use "git reset HEAD <file>..." to unstage)
816 # new file: dir2/added
817 # new file: sm
819 # Changes not staged for commit:
820 # (use "git add <file>..." to update what will be committed)
821 # (use "git checkout -- <file>..." to discard changes in working directory)
823 # modified: dir1/modified
825 # Submodule changes to be committed:
827 # * sm 0000000...$head (1):
828 # > Add foo
830 # Untracked files:
831 # (use "git add <file>..." to include in what will be committed)
833 # dir1/untracked
834 # dir2/modified
835 # dir2/untracked
836 # expect
837 # output
838 # untracked
840 test_expect_success 'status submodule summary' '
841 git config status.submodulesummary 10 &&
842 git status >output &&
843 test_i18ncmp expect output
846 cat >expect <<EOF
847 M dir1/modified
848 A dir2/added
849 A sm
850 ?? dir1/untracked
851 ?? dir2/modified
852 ?? dir2/untracked
853 ?? expect
854 ?? output
855 ?? untracked
857 test_expect_success 'status -s submodule summary' '
858 git status -s >output &&
859 test_cmp expect output
862 cat >expect <<EOF
863 # On branch master
864 # Changes not staged for commit:
865 # (use "git add <file>..." to update what will be committed)
866 # (use "git checkout -- <file>..." to discard changes in working directory)
868 # modified: dir1/modified
870 # Untracked files:
871 # (use "git add <file>..." to include in what will be committed)
873 # dir1/untracked
874 # dir2/modified
875 # dir2/untracked
876 # expect
877 # output
878 # untracked
879 no changes added to commit (use "git add" and/or "git commit -a")
881 test_expect_success 'status submodule summary (clean submodule): commit' '
882 git commit -m "commit submodule" &&
883 git config status.submodulesummary 10 &&
884 test_must_fail git commit --dry-run >output &&
885 test_i18ncmp expect output &&
886 git status >output &&
887 test_i18ncmp expect output
890 cat >expect <<EOF
891 M dir1/modified
892 ?? dir1/untracked
893 ?? dir2/modified
894 ?? dir2/untracked
895 ?? expect
896 ?? output
897 ?? untracked
899 test_expect_success 'status -s submodule summary (clean submodule)' '
900 git status -s >output &&
901 test_cmp expect output
904 test_expect_success 'status -z implies porcelain' '
905 git status --porcelain |
906 perl -pe "s/\012/\000/g" >expect &&
907 git status -z >output &&
908 test_cmp expect output
911 cat >expect <<EOF
912 # On branch master
913 # Changes to be committed:
914 # (use "git reset HEAD^1 <file>..." to unstage)
916 # new file: dir2/added
917 # new file: sm
919 # Changes not staged for commit:
920 # (use "git add <file>..." to update what will be committed)
921 # (use "git checkout -- <file>..." to discard changes in working directory)
923 # modified: dir1/modified
925 # Submodule changes to be committed:
927 # * sm 0000000...$head (1):
928 # > Add foo
930 # Untracked files:
931 # (use "git add <file>..." to include in what will be committed)
933 # dir1/untracked
934 # dir2/modified
935 # dir2/untracked
936 # expect
937 # output
938 # untracked
940 test_expect_success 'commit --dry-run submodule summary (--amend)' '
941 git config status.submodulesummary 10 &&
942 git commit --dry-run --amend >output &&
943 test_i18ncmp expect output
946 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
948 chmod a-w .git &&
949 # make dir1/tracked stat-dirty
950 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
951 git status -s >output &&
952 ! grep dir1/tracked output &&
953 # make sure "status" succeeded without writing index out
954 git diff-files | grep dir1/tracked
956 status=$?
957 chmod 775 .git
958 (exit $status)
961 (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
962 new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
963 touch .gitmodules
965 cat > expect << EOF
966 # On branch master
967 # Changes to be committed:
968 # (use "git reset HEAD <file>..." to unstage)
970 # modified: sm
972 # Changes not staged for commit:
973 # (use "git add <file>..." to update what will be committed)
974 # (use "git checkout -- <file>..." to discard changes in working directory)
976 # modified: dir1/modified
978 # Submodule changes to be committed:
980 # * sm $head...$new_head (1):
981 # > Add bar
983 # Untracked files:
984 # (use "git add <file>..." to include in what will be committed)
986 # .gitmodules
987 # dir1/untracked
988 # dir2/modified
989 # dir2/untracked
990 # expect
991 # output
992 # untracked
995 test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
996 echo modified sm/untracked &&
997 git status --ignore-submodules=untracked >output &&
998 test_i18ncmp expect output
1001 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
1002 git config diff.ignoreSubmodules dirty &&
1003 git status >output &&
1004 test_i18ncmp expect output &&
1005 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1006 git config --add -f .gitmodules submodule.subname.path sm &&
1007 git status >output &&
1008 test_i18ncmp expect output &&
1009 git config -f .gitmodules --remove-section submodule.subname &&
1010 git config --unset diff.ignoreSubmodules
1013 test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
1014 git config --add -f .gitmodules submodule.subname.ignore none &&
1015 git config --add -f .gitmodules submodule.subname.path sm &&
1016 git config --add submodule.subname.ignore untracked &&
1017 git config --add submodule.subname.path sm &&
1018 git status >output &&
1019 test_i18ncmp expect output &&
1020 git config --remove-section submodule.subname &&
1021 git config --remove-section -f .gitmodules submodule.subname
1024 test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
1025 git status --ignore-submodules=dirty >output &&
1026 test_i18ncmp expect output
1029 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
1030 git config diff.ignoreSubmodules dirty &&
1031 git status >output &&
1032 ! test -s actual &&
1033 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1034 git config --add -f .gitmodules submodule.subname.path sm &&
1035 git status >output &&
1036 test_i18ncmp expect output &&
1037 git config -f .gitmodules --remove-section submodule.subname &&
1038 git config --unset diff.ignoreSubmodules
1041 test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
1042 git config --add -f .gitmodules submodule.subname.ignore none &&
1043 git config --add -f .gitmodules submodule.subname.path sm &&
1044 git config --add submodule.subname.ignore dirty &&
1045 git config --add submodule.subname.path sm &&
1046 git status >output &&
1047 test_i18ncmp expect output &&
1048 git config --remove-section submodule.subname &&
1049 git config -f .gitmodules --remove-section submodule.subname
1052 test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
1053 echo modified >sm/foo &&
1054 git status --ignore-submodules=dirty >output &&
1055 test_i18ncmp expect output
1058 test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
1059 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1060 git config --add -f .gitmodules submodule.subname.path sm &&
1061 git status >output &&
1062 test_i18ncmp expect output &&
1063 git config -f .gitmodules --remove-section submodule.subname
1066 test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
1067 git config --add -f .gitmodules submodule.subname.ignore none &&
1068 git config --add -f .gitmodules submodule.subname.path sm &&
1069 git config --add submodule.subname.ignore dirty &&
1070 git config --add submodule.subname.path sm &&
1071 git status >output &&
1072 test_i18ncmp expect output &&
1073 git config --remove-section submodule.subname &&
1074 git config -f .gitmodules --remove-section submodule.subname
1077 cat > expect << EOF
1078 # On branch master
1079 # Changes to be committed:
1080 # (use "git reset HEAD <file>..." to unstage)
1082 # modified: sm
1084 # Changes not staged for commit:
1085 # (use "git add <file>..." to update what will be committed)
1086 # (use "git checkout -- <file>..." to discard changes in working directory)
1087 # (commit or discard the untracked or modified content in submodules)
1089 # modified: dir1/modified
1090 # modified: sm (modified content)
1092 # Submodule changes to be committed:
1094 # * sm $head...$new_head (1):
1095 # > Add bar
1097 # Untracked files:
1098 # (use "git add <file>..." to include in what will be committed)
1100 # .gitmodules
1101 # dir1/untracked
1102 # dir2/modified
1103 # dir2/untracked
1104 # expect
1105 # output
1106 # untracked
1109 test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1110 git status --ignore-submodules=untracked > output &&
1111 test_i18ncmp expect output
1114 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1115 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1116 git config --add -f .gitmodules submodule.subname.path sm &&
1117 git status >output &&
1118 test_i18ncmp expect output &&
1119 git config -f .gitmodules --remove-section submodule.subname
1122 test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
1123 git config --add -f .gitmodules submodule.subname.ignore none &&
1124 git config --add -f .gitmodules submodule.subname.path sm &&
1125 git config --add submodule.subname.ignore untracked &&
1126 git config --add submodule.subname.path sm &&
1127 git status >output &&
1128 test_i18ncmp expect output &&
1129 git config --remove-section submodule.subname &&
1130 git config -f .gitmodules --remove-section submodule.subname
1133 head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
1135 cat > expect << EOF
1136 # On branch master
1137 # Changes to be committed:
1138 # (use "git reset HEAD <file>..." to unstage)
1140 # modified: sm
1142 # Changes not staged for commit:
1143 # (use "git add <file>..." to update what will be committed)
1144 # (use "git checkout -- <file>..." to discard changes in working directory)
1146 # modified: dir1/modified
1147 # modified: sm (new commits)
1149 # Submodule changes to be committed:
1151 # * sm $head...$new_head (1):
1152 # > Add bar
1154 # Submodules changed but not updated:
1156 # * sm $new_head...$head2 (1):
1157 # > 2nd commit
1159 # Untracked files:
1160 # (use "git add <file>..." to include in what will be committed)
1162 # .gitmodules
1163 # dir1/untracked
1164 # dir2/modified
1165 # dir2/untracked
1166 # expect
1167 # output
1168 # untracked
1171 test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1172 git status --ignore-submodules=untracked > output &&
1173 test_i18ncmp expect output
1176 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1177 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1178 git config --add -f .gitmodules submodule.subname.path sm &&
1179 git status >output &&
1180 test_i18ncmp expect output &&
1181 git config -f .gitmodules --remove-section submodule.subname
1184 test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
1185 git config --add -f .gitmodules submodule.subname.ignore none &&
1186 git config --add -f .gitmodules submodule.subname.path sm &&
1187 git config --add submodule.subname.ignore untracked &&
1188 git config --add submodule.subname.path sm &&
1189 git status >output &&
1190 test_i18ncmp expect output &&
1191 git config --remove-section submodule.subname &&
1192 git config -f .gitmodules --remove-section submodule.subname
1195 test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
1196 git status --ignore-submodules=dirty > output &&
1197 test_i18ncmp expect output
1199 test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1200 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1201 git config --add -f .gitmodules submodule.subname.path sm &&
1202 git status >output &&
1203 test_i18ncmp expect output &&
1204 git config -f .gitmodules --remove-section submodule.subname
1207 test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
1208 git config --add -f .gitmodules submodule.subname.ignore none &&
1209 git config --add -f .gitmodules submodule.subname.path sm &&
1210 git config --add submodule.subname.ignore dirty &&
1211 git config --add submodule.subname.path sm &&
1212 git status >output &&
1213 test_i18ncmp expect output &&
1214 git config --remove-section submodule.subname &&
1215 git config -f .gitmodules --remove-section submodule.subname
1218 cat > expect << EOF
1219 # On branch master
1220 # Changes not staged for commit:
1221 # (use "git add <file>..." to update what will be committed)
1222 # (use "git checkout -- <file>..." to discard changes in working directory)
1224 # modified: dir1/modified
1226 # Untracked files:
1227 # (use "git add <file>..." to include in what will be committed)
1229 # .gitmodules
1230 # dir1/untracked
1231 # dir2/modified
1232 # dir2/untracked
1233 # expect
1234 # output
1235 # untracked
1236 no changes added to commit (use "git add" and/or "git commit -a")
1239 test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1240 git status --ignore-submodules=all > output &&
1241 test_i18ncmp expect output
1244 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1245 git config --add -f .gitmodules submodule.subname.ignore all &&
1246 git config --add -f .gitmodules submodule.subname.path sm &&
1247 git status > output &&
1248 test_cmp expect output &&
1249 git config -f .gitmodules --remove-section submodule.subname
1252 test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1253 git config --add -f .gitmodules submodule.subname.ignore none &&
1254 git config --add -f .gitmodules submodule.subname.path sm &&
1255 git config --add submodule.subname.ignore all &&
1256 git config --add submodule.subname.path sm &&
1257 git status > output &&
1258 test_cmp expect output &&
1259 git config --remove-section submodule.subname &&
1260 git config -f .gitmodules --remove-section submodule.subname
1263 test_done