t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
[git/git-svn.git] / t / t7508-status.sh
blobaecb4d1e5fdc1e966aad07ee1f1e7af834388bb2
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 git config --global advice.statusuoption false &&
12 mkdir broken &&
13 test_when_finished "rm -fr broken" &&
15 cd broken &&
16 git init &&
17 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
18 test_expect_code 129 git status -h >usage 2>&1
19 ) &&
20 test_i18ngrep "[Uu]sage" broken/usage
23 test_expect_success 'commit -h in broken repository' '
24 mkdir broken &&
25 test_when_finished "rm -fr broken" &&
27 cd broken &&
28 git init &&
29 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
30 test_expect_code 129 git commit -h >usage 2>&1
31 ) &&
32 test_i18ngrep "[Uu]sage" broken/usage
35 test_expect_success 'setup' '
36 : >tracked &&
37 : >modified &&
38 mkdir dir1 &&
39 : >dir1/tracked &&
40 : >dir1/modified &&
41 mkdir dir2 &&
42 : >dir1/tracked &&
43 : >dir1/modified &&
44 git add . &&
46 git status >output &&
48 test_tick &&
49 git commit -m initial &&
50 : >untracked &&
51 : >dir1/untracked &&
52 : >dir2/untracked &&
53 echo 1 >dir1/modified &&
54 echo 2 >dir2/modified &&
55 echo 3 >dir2/added &&
56 git add dir2/added
59 test_expect_success 'status (1)' '
60 test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
63 test_expect_success 'status --column' '
64 COLUMNS=50 git status --column="column dense" >output &&
65 cat >expect <<\EOF &&
66 # On branch master
67 # Changes to be committed:
68 # (use "git reset HEAD <file>..." to unstage)
70 # new file: dir2/added
72 # Changes not staged for commit:
73 # (use "git add <file>..." to update what will be committed)
74 # (use "git checkout -- <file>..." to discard changes in working directory)
76 # modified: dir1/modified
78 # Untracked files:
79 # (use "git add <file>..." to include in what will be committed)
81 # dir1/untracked dir2/untracked untracked
82 # dir2/modified output
83 EOF
84 test_i18ncmp expect output
87 cat >expect <<\EOF
88 # On branch master
89 # Changes to be committed:
90 # (use "git reset HEAD <file>..." to unstage)
92 # new file: dir2/added
94 # Changes not staged for commit:
95 # (use "git add <file>..." to update what will be committed)
96 # (use "git checkout -- <file>..." to discard changes in working directory)
98 # modified: dir1/modified
100 # Untracked files:
101 # (use "git add <file>..." to include in what will be committed)
103 # dir1/untracked
104 # dir2/modified
105 # dir2/untracked
106 # expect
107 # output
108 # untracked
111 test_expect_success 'status (2)' '
112 git status >output &&
113 test_i18ncmp expect output
116 cat >expect <<\EOF
117 # On branch master
118 # Changes to be committed:
119 # new file: dir2/added
121 # Changes not staged for commit:
122 # modified: dir1/modified
124 # Untracked files:
125 # dir1/untracked
126 # dir2/modified
127 # dir2/untracked
128 # expect
129 # output
130 # untracked
133 test_expect_success 'status (advice.statusHints false)' '
134 test_when_finished "git config --unset advice.statusHints" &&
135 git config advice.statusHints false &&
136 git status >output &&
137 test_i18ncmp expect output
141 cat >expect <<\EOF
142 M dir1/modified
143 A dir2/added
144 ?? dir1/untracked
145 ?? dir2/modified
146 ?? dir2/untracked
147 ?? expect
148 ?? output
149 ?? untracked
152 test_expect_success 'status -s' '
154 git status -s >output &&
155 test_cmp expect output
159 test_expect_success 'status with gitignore' '
161 echo ".gitignore" &&
162 echo "expect" &&
163 echo "output" &&
164 echo "untracked"
165 } >.gitignore &&
167 cat >expect <<-\EOF &&
168 M dir1/modified
169 A dir2/added
170 ?? dir2/modified
172 git status -s >output &&
173 test_cmp expect output &&
175 cat >expect <<-\EOF &&
176 M dir1/modified
177 A dir2/added
178 ?? dir2/modified
179 !! .gitignore
180 !! dir1/untracked
181 !! dir2/untracked
182 !! expect
183 !! output
184 !! untracked
186 git status -s --ignored >output &&
187 test_cmp expect output &&
189 cat >expect <<-\EOF &&
190 # On branch master
191 # Changes to be committed:
192 # (use "git reset HEAD <file>..." to unstage)
194 # new file: dir2/added
196 # Changes not staged for commit:
197 # (use "git add <file>..." to update what will be committed)
198 # (use "git checkout -- <file>..." to discard changes in working directory)
200 # modified: dir1/modified
202 # Untracked files:
203 # (use "git add <file>..." to include in what will be committed)
205 # dir2/modified
206 # Ignored files:
207 # (use "git add -f <file>..." to include in what will be committed)
209 # .gitignore
210 # dir1/untracked
211 # dir2/untracked
212 # expect
213 # output
214 # untracked
216 git status --ignored >output &&
217 test_i18ncmp expect output
220 test_expect_success 'status with gitignore (nothing untracked)' '
222 echo ".gitignore" &&
223 echo "expect" &&
224 echo "dir2/modified" &&
225 echo "output" &&
226 echo "untracked"
227 } >.gitignore &&
229 cat >expect <<-\EOF &&
230 M dir1/modified
231 A dir2/added
233 git status -s >output &&
234 test_cmp expect output &&
236 cat >expect <<-\EOF &&
237 M dir1/modified
238 A dir2/added
239 !! .gitignore
240 !! dir1/untracked
241 !! dir2/modified
242 !! dir2/untracked
243 !! expect
244 !! output
245 !! untracked
247 git status -s --ignored >output &&
248 test_cmp expect output &&
250 cat >expect <<-\EOF &&
251 # On branch master
252 # Changes to be committed:
253 # (use "git reset HEAD <file>..." to unstage)
255 # new file: dir2/added
257 # Changes not staged for commit:
258 # (use "git add <file>..." to update what will be committed)
259 # (use "git checkout -- <file>..." to discard changes in working directory)
261 # modified: dir1/modified
263 # Ignored files:
264 # (use "git add -f <file>..." to include in what will be committed)
266 # .gitignore
267 # dir1/untracked
268 # dir2/modified
269 # dir2/untracked
270 # expect
271 # output
272 # untracked
274 git status --ignored >output &&
275 test_i18ncmp expect output
278 rm -f .gitignore
280 cat >expect <<\EOF
281 ## master
282 M dir1/modified
283 A dir2/added
284 ?? dir1/untracked
285 ?? dir2/modified
286 ?? dir2/untracked
287 ?? expect
288 ?? output
289 ?? untracked
292 test_expect_success 'status -s -b' '
294 git status -s -b >output &&
295 test_cmp expect output
299 test_expect_success 'status -s -z -b' '
300 tr "\\n" Q <expect >expect.q &&
301 mv expect.q expect &&
302 git status -s -z -b >output &&
303 nul_to_q <output >output.q &&
304 mv output.q output &&
305 test_cmp expect output
308 test_expect_success 'setup dir3' '
309 mkdir dir3 &&
310 : >dir3/untracked1 &&
311 : >dir3/untracked2
314 cat >expect <<EOF
315 # On branch master
316 # Changes to be committed:
317 # (use "git reset HEAD <file>..." to unstage)
319 # new file: dir2/added
321 # Changes not staged for commit:
322 # (use "git add <file>..." to update what will be committed)
323 # (use "git checkout -- <file>..." to discard changes in working directory)
325 # modified: dir1/modified
327 # Untracked files not listed (use -u option to show untracked files)
329 test_expect_success 'status -uno' '
330 git status -uno >output &&
331 test_i18ncmp expect output
334 test_expect_success 'status (status.showUntrackedFiles no)' '
335 git config status.showuntrackedfiles no
336 test_when_finished "git config --unset status.showuntrackedfiles" &&
337 git status >output &&
338 test_i18ncmp expect output
341 cat >expect <<EOF
342 # On branch master
343 # Changes to be committed:
344 # new file: dir2/added
346 # Changes not staged for commit:
347 # modified: dir1/modified
349 # Untracked files not listed
351 git config advice.statusHints false
352 test_expect_success 'status -uno (advice.statusHints false)' '
353 git status -uno >output &&
354 test_i18ncmp expect output
356 git config --unset advice.statusHints
358 cat >expect << EOF
359 M dir1/modified
360 A dir2/added
362 test_expect_success 'status -s -uno' '
363 git status -s -uno >output &&
364 test_cmp expect output
367 test_expect_success 'status -s (status.showUntrackedFiles no)' '
368 git config status.showuntrackedfiles no
369 git status -s >output &&
370 test_cmp expect output
373 cat >expect <<EOF
374 # On branch master
375 # Changes to be committed:
376 # (use "git reset HEAD <file>..." to unstage)
378 # new file: dir2/added
380 # Changes not staged for commit:
381 # (use "git add <file>..." to update what will be committed)
382 # (use "git checkout -- <file>..." to discard changes in working directory)
384 # modified: dir1/modified
386 # Untracked files:
387 # (use "git add <file>..." to include in what will be committed)
389 # dir1/untracked
390 # dir2/modified
391 # dir2/untracked
392 # dir3/
393 # expect
394 # output
395 # untracked
397 test_expect_success 'status -unormal' '
398 git status -unormal >output &&
399 test_i18ncmp expect output
402 test_expect_success 'status (status.showUntrackedFiles normal)' '
403 git config status.showuntrackedfiles normal
404 test_when_finished "git config --unset status.showuntrackedfiles" &&
405 git status >output &&
406 test_i18ncmp expect output
409 cat >expect <<EOF
410 M dir1/modified
411 A dir2/added
412 ?? dir1/untracked
413 ?? dir2/modified
414 ?? dir2/untracked
415 ?? dir3/
416 ?? expect
417 ?? output
418 ?? untracked
420 test_expect_success 'status -s -unormal' '
421 git status -s -unormal >output &&
422 test_cmp expect output
425 test_expect_success 'status -s (status.showUntrackedFiles normal)' '
426 git config status.showuntrackedfiles normal
427 git status -s >output &&
428 test_cmp expect output
431 cat >expect <<EOF
432 # On branch master
433 # Changes to be committed:
434 # (use "git reset HEAD <file>..." to unstage)
436 # new file: dir2/added
438 # Changes not staged for commit:
439 # (use "git add <file>..." to update what will be committed)
440 # (use "git checkout -- <file>..." to discard changes in working directory)
442 # modified: dir1/modified
444 # Untracked files:
445 # (use "git add <file>..." to include in what will be committed)
447 # dir1/untracked
448 # dir2/modified
449 # dir2/untracked
450 # dir3/untracked1
451 # dir3/untracked2
452 # expect
453 # output
454 # untracked
456 test_expect_success 'status -uall' '
457 git status -uall >output &&
458 test_i18ncmp expect output
461 test_expect_success 'status (status.showUntrackedFiles all)' '
462 git config status.showuntrackedfiles all
463 test_when_finished "git config --unset status.showuntrackedfiles" &&
464 git status >output &&
465 test_i18ncmp expect output
468 test_expect_success 'teardown dir3' '
469 rm -rf dir3
472 cat >expect <<EOF
473 M dir1/modified
474 A dir2/added
475 ?? dir1/untracked
476 ?? dir2/modified
477 ?? dir2/untracked
478 ?? expect
479 ?? output
480 ?? untracked
482 test_expect_success 'status -s -uall' '
483 git config --unset status.showuntrackedfiles
484 git status -s -uall >output &&
485 test_cmp expect output
487 test_expect_success 'status -s (status.showUntrackedFiles all)' '
488 git config status.showuntrackedfiles all
489 git status -s >output &&
490 rm -rf dir3 &&
491 git config --unset status.showuntrackedfiles &&
492 test_cmp expect output
495 cat >expect <<\EOF
496 # On branch master
497 # Changes to be committed:
498 # (use "git reset HEAD <file>..." to unstage)
500 # new file: ../dir2/added
502 # Changes not staged for commit:
503 # (use "git add <file>..." to update what will be committed)
504 # (use "git checkout -- <file>..." to discard changes in working directory)
506 # modified: modified
508 # Untracked files:
509 # (use "git add <file>..." to include in what will be committed)
511 # untracked
512 # ../dir2/modified
513 # ../dir2/untracked
514 # ../expect
515 # ../output
516 # ../untracked
519 test_expect_success 'status with relative paths' '
520 (cd dir1 && git status) >output &&
521 test_i18ncmp expect output
524 cat >expect <<\EOF
525 M modified
526 A ../dir2/added
527 ?? untracked
528 ?? ../dir2/modified
529 ?? ../dir2/untracked
530 ?? ../expect
531 ?? ../output
532 ?? ../untracked
534 test_expect_success 'status -s with relative paths' '
536 (cd dir1 && git status -s) >output &&
537 test_cmp expect output
541 cat >expect <<\EOF
542 M dir1/modified
543 A dir2/added
544 ?? dir1/untracked
545 ?? dir2/modified
546 ?? dir2/untracked
547 ?? expect
548 ?? output
549 ?? untracked
552 test_expect_success 'status --porcelain ignores relative paths setting' '
554 (cd dir1 && git status --porcelain) >output &&
555 test_cmp expect output
559 test_expect_success 'setup unique colors' '
561 git config status.color.untracked blue &&
562 git config status.color.branch green
566 cat >expect <<\EOF
567 # On branch <GREEN>master<RESET>
568 # Changes to be committed:
569 # (use "git reset HEAD <file>..." to unstage)
571 # <GREEN>new file: dir2/added<RESET>
573 # Changes not staged for commit:
574 # (use "git add <file>..." to update what will be committed)
575 # (use "git checkout -- <file>..." to discard changes in working directory)
577 # <RED>modified: dir1/modified<RESET>
579 # Untracked files:
580 # (use "git add <file>..." to include in what will be committed)
582 # <BLUE>dir1/untracked<RESET>
583 # <BLUE>dir2/modified<RESET>
584 # <BLUE>dir2/untracked<RESET>
585 # <BLUE>expect<RESET>
586 # <BLUE>output<RESET>
587 # <BLUE>untracked<RESET>
590 test_expect_success 'status with color.ui' '
591 git config color.ui always &&
592 test_when_finished "git config --unset color.ui" &&
593 git status | test_decode_color >output &&
594 test_i18ncmp expect output
597 test_expect_success 'status with color.status' '
598 git config color.status always &&
599 test_when_finished "git config --unset color.status" &&
600 git status | test_decode_color >output &&
601 test_i18ncmp expect output
604 cat >expect <<\EOF
605 <RED>M<RESET> dir1/modified
606 <GREEN>A<RESET> dir2/added
607 <BLUE>??<RESET> dir1/untracked
608 <BLUE>??<RESET> dir2/modified
609 <BLUE>??<RESET> dir2/untracked
610 <BLUE>??<RESET> expect
611 <BLUE>??<RESET> output
612 <BLUE>??<RESET> untracked
615 test_expect_success 'status -s with color.ui' '
617 git config color.ui always &&
618 git status -s | test_decode_color >output &&
619 test_cmp expect output
623 test_expect_success 'status -s with color.status' '
625 git config --unset color.ui &&
626 git config color.status always &&
627 git status -s | test_decode_color >output &&
628 test_cmp expect output
632 cat >expect <<\EOF
633 ## <GREEN>master<RESET>
634 <RED>M<RESET> dir1/modified
635 <GREEN>A<RESET> dir2/added
636 <BLUE>??<RESET> dir1/untracked
637 <BLUE>??<RESET> dir2/modified
638 <BLUE>??<RESET> dir2/untracked
639 <BLUE>??<RESET> expect
640 <BLUE>??<RESET> output
641 <BLUE>??<RESET> untracked
644 test_expect_success 'status -s -b with color.status' '
646 git status -s -b | test_decode_color >output &&
647 test_cmp expect output
651 cat >expect <<\EOF
652 M dir1/modified
653 A dir2/added
654 ?? dir1/untracked
655 ?? dir2/modified
656 ?? dir2/untracked
657 ?? expect
658 ?? output
659 ?? untracked
662 test_expect_success 'status --porcelain ignores color.ui' '
664 git config --unset color.status &&
665 git config color.ui always &&
666 git status --porcelain | test_decode_color >output &&
667 test_cmp expect output
671 test_expect_success 'status --porcelain ignores color.status' '
673 git config --unset color.ui &&
674 git config color.status always &&
675 git status --porcelain | test_decode_color >output &&
676 test_cmp expect output
680 # recover unconditionally from color tests
681 git config --unset color.status
682 git config --unset color.ui
684 test_expect_success 'status --porcelain respects -b' '
686 git status --porcelain -b >output &&
688 echo "## master" &&
689 cat expect
690 } >tmp &&
691 mv tmp expect &&
692 test_cmp expect output
696 cat >expect <<\EOF
697 # On branch master
698 # Changes to be committed:
699 # (use "git reset HEAD <file>..." to unstage)
701 # new file: dir2/added
703 # Changes not staged for commit:
704 # (use "git add <file>..." to update what will be committed)
705 # (use "git checkout -- <file>..." to discard changes in working directory)
707 # modified: dir1/modified
709 # Untracked files:
710 # (use "git add <file>..." to include in what will be committed)
712 # dir1/untracked
713 # dir2/modified
714 # dir2/untracked
715 # expect
716 # output
717 # untracked
721 test_expect_success 'status without relative paths' '
723 git config status.relativePaths false &&
724 test_when_finished "git config --unset status.relativePaths" &&
725 (cd dir1 && git status) >output &&
726 test_i18ncmp expect output
730 cat >expect <<\EOF
731 M dir1/modified
732 A dir2/added
733 ?? dir1/untracked
734 ?? dir2/modified
735 ?? dir2/untracked
736 ?? expect
737 ?? output
738 ?? untracked
741 test_expect_success 'status -s without relative paths' '
743 git config status.relativePaths false &&
744 test_when_finished "git config --unset status.relativePaths" &&
745 (cd dir1 && git status -s) >output &&
746 test_cmp expect output
750 cat <<EOF >expect
751 # On branch master
752 # Changes to be committed:
753 # (use "git reset HEAD <file>..." to unstage)
755 # modified: dir1/modified
757 # Untracked files:
758 # (use "git add <file>..." to include in what will be committed)
760 # dir1/untracked
761 # dir2/
762 # expect
763 # output
764 # untracked
766 test_expect_success 'dry-run of partial commit excluding new file in index' '
767 git commit --dry-run dir1/modified >output &&
768 test_i18ncmp expect output
771 cat >expect <<EOF
772 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
774 test_expect_success 'status refreshes the index' '
775 touch dir2/added &&
776 git status &&
777 git diff-files >output &&
778 test_cmp expect output
781 test_expect_success 'setup status submodule summary' '
782 test_create_repo sm && (
783 cd sm &&
784 >foo &&
785 git add foo &&
786 git commit -m "Add foo"
787 ) &&
788 git add sm
791 cat >expect <<EOF
792 # On branch master
793 # Changes to be committed:
794 # (use "git reset HEAD <file>..." to unstage)
796 # new file: dir2/added
797 # new file: sm
799 # Changes not staged for commit:
800 # (use "git add <file>..." to update what will be committed)
801 # (use "git checkout -- <file>..." to discard changes in working directory)
803 # modified: dir1/modified
805 # Untracked files:
806 # (use "git add <file>..." to include in what will be committed)
808 # dir1/untracked
809 # dir2/modified
810 # dir2/untracked
811 # expect
812 # output
813 # untracked
815 test_expect_success 'status submodule summary is disabled by default' '
816 git status >output &&
817 test_i18ncmp expect output
820 # we expect the same as the previous test
821 test_expect_success 'status --untracked-files=all does not show submodule' '
822 git status --untracked-files=all >output &&
823 test_i18ncmp expect output
826 cat >expect <<EOF
827 M dir1/modified
828 A dir2/added
829 A sm
830 ?? dir1/untracked
831 ?? dir2/modified
832 ?? dir2/untracked
833 ?? expect
834 ?? output
835 ?? untracked
837 test_expect_success 'status -s submodule summary is disabled by default' '
838 git status -s >output &&
839 test_cmp expect output
842 # we expect the same as the previous test
843 test_expect_success 'status -s --untracked-files=all does not show submodule' '
844 git status -s --untracked-files=all >output &&
845 test_cmp expect output
848 head=$(cd sm && git rev-parse --short=7 --verify HEAD)
850 cat >expect <<EOF
851 # On branch master
852 # Changes to be committed:
853 # (use "git reset HEAD <file>..." to unstage)
855 # new file: dir2/added
856 # new file: sm
858 # Changes not staged for commit:
859 # (use "git add <file>..." to update what will be committed)
860 # (use "git checkout -- <file>..." to discard changes in working directory)
862 # modified: dir1/modified
864 # Submodule changes to be committed:
866 # * sm 0000000...$head (1):
867 # > Add foo
869 # Untracked files:
870 # (use "git add <file>..." to include in what will be committed)
872 # dir1/untracked
873 # dir2/modified
874 # dir2/untracked
875 # expect
876 # output
877 # untracked
879 test_expect_success 'status submodule summary' '
880 git config status.submodulesummary 10 &&
881 git status >output &&
882 test_i18ncmp expect output
885 cat >expect <<EOF
886 M dir1/modified
887 A dir2/added
888 A sm
889 ?? dir1/untracked
890 ?? dir2/modified
891 ?? dir2/untracked
892 ?? expect
893 ?? output
894 ?? untracked
896 test_expect_success 'status -s submodule summary' '
897 git status -s >output &&
898 test_cmp expect output
901 cat >expect <<EOF
902 # On branch master
903 # Changes not staged for commit:
904 # (use "git add <file>..." to update what will be committed)
905 # (use "git checkout -- <file>..." to discard changes in working directory)
907 # modified: dir1/modified
909 # Untracked files:
910 # (use "git add <file>..." to include in what will be committed)
912 # dir1/untracked
913 # dir2/modified
914 # dir2/untracked
915 # expect
916 # output
917 # untracked
918 no changes added to commit (use "git add" and/or "git commit -a")
920 test_expect_success 'status submodule summary (clean submodule): commit' '
921 git commit -m "commit submodule" &&
922 git config status.submodulesummary 10 &&
923 test_must_fail git commit --dry-run >output &&
924 test_i18ncmp expect output &&
925 git status >output &&
926 test_i18ncmp expect output
929 cat >expect <<EOF
930 M dir1/modified
931 ?? dir1/untracked
932 ?? dir2/modified
933 ?? dir2/untracked
934 ?? expect
935 ?? output
936 ?? untracked
938 test_expect_success 'status -s submodule summary (clean submodule)' '
939 git status -s >output &&
940 test_cmp expect output
943 test_expect_success 'status -z implies porcelain' '
944 git status --porcelain |
945 "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
946 git status -z >output &&
947 test_cmp expect output
950 cat >expect <<EOF
951 # On branch master
952 # Changes to be committed:
953 # (use "git reset HEAD^1 <file>..." to unstage)
955 # new file: dir2/added
956 # new file: 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)
962 # modified: dir1/modified
964 # Submodule changes to be committed:
966 # * sm 0000000...$head (1):
967 # > Add foo
969 # Untracked files:
970 # (use "git add <file>..." to include in what will be committed)
972 # dir1/untracked
973 # dir2/modified
974 # dir2/untracked
975 # expect
976 # output
977 # untracked
979 test_expect_success 'commit --dry-run submodule summary (--amend)' '
980 git config status.submodulesummary 10 &&
981 git commit --dry-run --amend >output &&
982 test_i18ncmp expect output
985 test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
987 chmod a-w .git &&
988 # make dir1/tracked stat-dirty
989 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
990 git status -s >output &&
991 ! grep dir1/tracked output &&
992 # make sure "status" succeeded without writing index out
993 git diff-files | grep dir1/tracked
995 status=$?
996 chmod 775 .git
997 (exit $status)
1000 (cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
1001 new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
1002 touch .gitmodules
1004 cat > expect << EOF
1005 # On branch master
1006 # Changes to be committed:
1007 # (use "git reset HEAD <file>..." to unstage)
1009 # modified: sm
1011 # Changes not staged for commit:
1012 # (use "git add <file>..." to update what will be committed)
1013 # (use "git checkout -- <file>..." to discard changes in working directory)
1015 # modified: dir1/modified
1017 # Submodule changes to be committed:
1019 # * sm $head...$new_head (1):
1020 # > Add bar
1022 # Untracked files:
1023 # (use "git add <file>..." to include in what will be committed)
1025 # .gitmodules
1026 # dir1/untracked
1027 # dir2/modified
1028 # dir2/untracked
1029 # expect
1030 # output
1031 # untracked
1034 test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
1035 echo modified sm/untracked &&
1036 git status --ignore-submodules=untracked >output &&
1037 test_i18ncmp expect output
1040 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
1041 git config diff.ignoreSubmodules dirty &&
1042 git status >output &&
1043 test_i18ncmp expect output &&
1044 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1045 git config --add -f .gitmodules submodule.subname.path sm &&
1046 git status >output &&
1047 test_i18ncmp expect output &&
1048 git config -f .gitmodules --remove-section submodule.subname &&
1049 git config --unset diff.ignoreSubmodules
1052 test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
1053 git config --add -f .gitmodules submodule.subname.ignore none &&
1054 git config --add -f .gitmodules submodule.subname.path sm &&
1055 git config --add submodule.subname.ignore untracked &&
1056 git config --add submodule.subname.path sm &&
1057 git status >output &&
1058 test_i18ncmp expect output &&
1059 git config --remove-section submodule.subname &&
1060 git config --remove-section -f .gitmodules submodule.subname
1063 test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
1064 git status --ignore-submodules=dirty >output &&
1065 test_i18ncmp expect output
1068 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
1069 git config diff.ignoreSubmodules dirty &&
1070 git status >output &&
1071 ! test -s actual &&
1072 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1073 git config --add -f .gitmodules submodule.subname.path sm &&
1074 git status >output &&
1075 test_i18ncmp expect output &&
1076 git config -f .gitmodules --remove-section submodule.subname &&
1077 git config --unset diff.ignoreSubmodules
1080 test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
1081 git config --add -f .gitmodules submodule.subname.ignore none &&
1082 git config --add -f .gitmodules submodule.subname.path sm &&
1083 git config --add submodule.subname.ignore dirty &&
1084 git config --add submodule.subname.path sm &&
1085 git status >output &&
1086 test_i18ncmp expect output &&
1087 git config --remove-section submodule.subname &&
1088 git config -f .gitmodules --remove-section submodule.subname
1091 test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
1092 echo modified >sm/foo &&
1093 git status --ignore-submodules=dirty >output &&
1094 test_i18ncmp expect output
1097 test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
1098 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1099 git config --add -f .gitmodules submodule.subname.path sm &&
1100 git status >output &&
1101 test_i18ncmp expect output &&
1102 git config -f .gitmodules --remove-section submodule.subname
1105 test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
1106 git config --add -f .gitmodules submodule.subname.ignore none &&
1107 git config --add -f .gitmodules submodule.subname.path sm &&
1108 git config --add submodule.subname.ignore dirty &&
1109 git config --add submodule.subname.path sm &&
1110 git status >output &&
1111 test_i18ncmp expect output &&
1112 git config --remove-section submodule.subname &&
1113 git config -f .gitmodules --remove-section submodule.subname
1116 cat > expect << EOF
1117 # On branch master
1118 # Changes to be committed:
1119 # (use "git reset HEAD <file>..." to unstage)
1121 # modified: sm
1123 # Changes not staged for commit:
1124 # (use "git add <file>..." to update what will be committed)
1125 # (use "git checkout -- <file>..." to discard changes in working directory)
1126 # (commit or discard the untracked or modified content in submodules)
1128 # modified: dir1/modified
1129 # modified: sm (modified content)
1131 # Submodule changes to be committed:
1133 # * sm $head...$new_head (1):
1134 # > Add bar
1136 # Untracked files:
1137 # (use "git add <file>..." to include in what will be committed)
1139 # .gitmodules
1140 # dir1/untracked
1141 # dir2/modified
1142 # dir2/untracked
1143 # expect
1144 # output
1145 # untracked
1148 test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1149 git status --ignore-submodules=untracked > output &&
1150 test_i18ncmp expect output
1153 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1154 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1155 git config --add -f .gitmodules submodule.subname.path sm &&
1156 git status >output &&
1157 test_i18ncmp expect output &&
1158 git config -f .gitmodules --remove-section submodule.subname
1161 test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
1162 git config --add -f .gitmodules submodule.subname.ignore none &&
1163 git config --add -f .gitmodules submodule.subname.path sm &&
1164 git config --add submodule.subname.ignore untracked &&
1165 git config --add submodule.subname.path sm &&
1166 git status >output &&
1167 test_i18ncmp expect output &&
1168 git config --remove-section submodule.subname &&
1169 git config -f .gitmodules --remove-section submodule.subname
1172 head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
1174 cat > expect << EOF
1175 # On branch master
1176 # Changes to be committed:
1177 # (use "git reset HEAD <file>..." to unstage)
1179 # modified: sm
1181 # Changes not staged for commit:
1182 # (use "git add <file>..." to update what will be committed)
1183 # (use "git checkout -- <file>..." to discard changes in working directory)
1185 # modified: dir1/modified
1186 # modified: sm (new commits)
1188 # Submodule changes to be committed:
1190 # * sm $head...$new_head (1):
1191 # > Add bar
1193 # Submodules changed but not updated:
1195 # * sm $new_head...$head2 (1):
1196 # > 2nd commit
1198 # Untracked files:
1199 # (use "git add <file>..." to include in what will be committed)
1201 # .gitmodules
1202 # dir1/untracked
1203 # dir2/modified
1204 # dir2/untracked
1205 # expect
1206 # output
1207 # untracked
1210 test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
1211 git status --ignore-submodules=untracked > output &&
1212 test_i18ncmp expect output
1215 test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
1216 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1217 git config --add -f .gitmodules submodule.subname.path sm &&
1218 git status >output &&
1219 test_i18ncmp expect output &&
1220 git config -f .gitmodules --remove-section submodule.subname
1223 test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
1224 git config --add -f .gitmodules submodule.subname.ignore none &&
1225 git config --add -f .gitmodules submodule.subname.path sm &&
1226 git config --add submodule.subname.ignore untracked &&
1227 git config --add submodule.subname.path sm &&
1228 git status >output &&
1229 test_i18ncmp expect output &&
1230 git config --remove-section submodule.subname &&
1231 git config -f .gitmodules --remove-section submodule.subname
1234 test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
1235 git status --ignore-submodules=dirty > output &&
1236 test_i18ncmp expect output
1238 test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
1239 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1240 git config --add -f .gitmodules submodule.subname.path sm &&
1241 git status >output &&
1242 test_i18ncmp expect output &&
1243 git config -f .gitmodules --remove-section submodule.subname
1246 test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
1247 git config --add -f .gitmodules submodule.subname.ignore none &&
1248 git config --add -f .gitmodules submodule.subname.path sm &&
1249 git config --add submodule.subname.ignore dirty &&
1250 git config --add submodule.subname.path sm &&
1251 git status >output &&
1252 test_i18ncmp expect output &&
1253 git config --remove-section submodule.subname &&
1254 git config -f .gitmodules --remove-section submodule.subname
1257 cat > expect << EOF
1258 ; On branch master
1259 ; Changes to be committed:
1260 ; (use "git reset HEAD <file>..." to unstage)
1262 ; modified: sm
1264 ; Changes not staged for commit:
1265 ; (use "git add <file>..." to update what will be committed)
1266 ; (use "git checkout -- <file>..." to discard changes in working directory)
1268 ; modified: dir1/modified
1269 ; modified: sm (new commits)
1271 ; Submodule changes to be committed:
1273 ; * sm $head...$new_head (1):
1274 ; > Add bar
1276 ; Submodules changed but not updated:
1278 ; * sm $new_head...$head2 (1):
1279 ; > 2nd commit
1281 ; Untracked files:
1282 ; (use "git add <file>..." to include in what will be committed)
1284 ; .gitmodules
1285 ; dir1/untracked
1286 ; dir2/modified
1287 ; dir2/untracked
1288 ; expect
1289 ; output
1290 ; untracked
1293 test_expect_success "status (core.commentchar with submodule summary)" '
1294 test_when_finished "git config --unset core.commentchar" &&
1295 git config core.commentchar ";" &&
1296 git status >output &&
1297 test_i18ncmp expect output
1300 test_expect_success "status (core.commentchar with two chars with submodule summary)" '
1301 test_when_finished "git config --unset core.commentchar" &&
1302 git config core.commentchar ";;" &&
1303 git status >output &&
1304 test_i18ncmp expect output
1307 cat > expect << EOF
1308 # On branch master
1309 # Changes not staged for commit:
1310 # (use "git add <file>..." to update what will be committed)
1311 # (use "git checkout -- <file>..." to discard changes in working directory)
1313 # modified: dir1/modified
1315 # Untracked files:
1316 # (use "git add <file>..." to include in what will be committed)
1318 # .gitmodules
1319 # dir1/untracked
1320 # dir2/modified
1321 # dir2/untracked
1322 # expect
1323 # output
1324 # untracked
1325 no changes added to commit (use "git add" and/or "git commit -a")
1328 test_expect_success "--ignore-submodules=all suppresses submodule summary" '
1329 git status --ignore-submodules=all > output &&
1330 test_i18ncmp expect output
1333 test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
1334 git config --add -f .gitmodules submodule.subname.ignore all &&
1335 git config --add -f .gitmodules submodule.subname.path sm &&
1336 git status > output &&
1337 test_cmp expect output &&
1338 git config -f .gitmodules --remove-section submodule.subname
1341 test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1342 git config --add -f .gitmodules submodule.subname.ignore none &&
1343 git config --add -f .gitmodules submodule.subname.path sm &&
1344 git config --add submodule.subname.ignore all &&
1345 git config --add submodule.subname.path sm &&
1346 git status > output &&
1347 test_cmp expect output &&
1348 git config --remove-section submodule.subname &&
1349 git config -f .gitmodules --remove-section submodule.subname
1352 test_done