3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='git status'
10 test_expect_success
'use status.displayCommentPrefix by default ' '
11 git config --global status.displayCommentPrefix true
14 test_expect_success
'status -h in broken repository' '
15 git config --global advice.statusuoption false &&
17 test_when_finished "rm -fr broken" &&
21 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
22 test_expect_code 129 git status -h >usage 2>&1
24 test_i18ngrep "[Uu]sage" broken/usage
27 test_expect_success
'commit -h in broken repository' '
29 test_when_finished "rm -fr broken" &&
33 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
34 test_expect_code 129 git commit -h >usage 2>&1
36 test_i18ngrep "[Uu]sage" broken/usage
39 test_expect_success
'setup' '
53 git commit -m initial &&
57 echo 1 >dir1/modified &&
58 echo 2 >dir2/modified &&
63 test_expect_success
'status (1)' '
64 test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
68 sed "s/^\# //; s/^\#$//; s/^#\t/\t/" <"$1" >"$1".tmp
&&
69 rm "$1" && mv "$1".tmp
"$1"
72 test_expect_success
'status --column' '
75 # Changes to be committed:
76 # (use "git reset HEAD <file>..." to unstage)
78 # new file: dir2/added
80 # Changes not staged for commit:
81 # (use "git add <file>..." to update what will be committed)
82 # (use "git checkout -- <file>..." to discard changes in working directory)
84 # modified: dir1/modified
87 # (use "git add <file>..." to include in what will be committed)
89 # dir1/untracked dir2/untracked output
90 # dir2/modified expect untracked
92 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
93 test_i18ncmp expect output
96 test_expect_success
'status --column status.displayCommentPrefix=false' '
97 strip_comments expect &&
98 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
99 test_i18ncmp expect output
104 # Changes to be committed:
105 # (use "git reset HEAD <file>..." to unstage)
107 # new file: dir2/added
109 # Changes not staged for commit:
110 # (use "git add <file>..." to update what will be committed)
111 # (use "git checkout -- <file>..." to discard changes in working directory)
113 # modified: dir1/modified
116 # (use "git add <file>..." to include in what will be committed)
126 test_expect_success
'status with status.displayCommentPrefix=true' '
127 git -c status.displayCommentPrefix=true status >output &&
128 test_i18ncmp expect output
131 test_expect_success
'status with status.displayCommentPrefix=false' '
132 strip_comments expect &&
133 git -c status.displayCommentPrefix=false status >output &&
134 test_i18ncmp expect output
137 test_expect_success
'setup fake editor' '
138 cat >.git/editor <<-\EOF &&
142 chmod 755 .git/editor
145 commit_template_commented
() {
147 EDITOR
=.git
/editor
&&
149 # Fails due to empty message
150 test_must_fail git commit
152 ! grep '^[^#]' output
155 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
156 commit_template_commented
161 # Changes to be committed:
162 # new file: dir2/added
164 # Changes not staged for commit:
165 # modified: dir1/modified
176 test_expect_success
'status (advice.statusHints false)' '
177 test_config advice.statusHints false &&
178 git status >output &&
179 test_i18ncmp expect output
194 test_expect_success
'status -s' '
196 git status -s >output &&
197 test_cmp expect output
201 test_expect_success
'status with gitignore' '
209 cat >expect <<-\EOF &&
214 git status -s >output &&
215 test_cmp expect output &&
217 cat >expect <<-\EOF &&
228 git status -s --ignored >output &&
229 test_cmp expect output &&
231 cat >expect <<-\EOF &&
233 # Changes to be committed:
234 # (use "git reset HEAD <file>..." to unstage)
236 # new file: dir2/added
238 # Changes not staged for commit:
239 # (use "git add <file>..." to update what will be committed)
240 # (use "git checkout -- <file>..." to discard changes in working directory)
242 # modified: dir1/modified
245 # (use "git add <file>..." to include in what will be committed)
249 # (use "git add -f <file>..." to include in what will be committed)
258 git status --ignored >output &&
259 test_i18ncmp expect output
262 test_expect_success
'status with gitignore (nothing untracked)' '
266 echo "dir2/modified" &&
271 cat >expect <<-\EOF &&
275 git status -s >output &&
276 test_cmp expect output &&
278 cat >expect <<-\EOF &&
289 git status -s --ignored >output &&
290 test_cmp expect output &&
292 cat >expect <<-\EOF &&
294 # Changes to be committed:
295 # (use "git reset HEAD <file>..." to unstage)
297 # new file: dir2/added
299 # Changes not staged for commit:
300 # (use "git add <file>..." to update what will be committed)
301 # (use "git checkout -- <file>..." to discard changes in working directory)
303 # modified: dir1/modified
306 # (use "git add -f <file>..." to include in what will be committed)
316 git status --ignored >output &&
317 test_i18ncmp expect output
334 test_expect_success
'status -s -b' '
336 git status -s -b >output &&
337 test_cmp expect output
341 test_expect_success
'status -s -z -b' '
342 tr "\\n" Q <expect >expect.q &&
343 mv expect.q expect &&
344 git status -s -z -b >output &&
345 nul_to_q <output >output.q &&
346 mv output.q output &&
347 test_cmp expect output
350 test_expect_success
'setup dir3' '
352 : >dir3/untracked1 &&
358 # Changes to be committed:
359 # (use "git reset HEAD <file>..." to unstage)
361 # new file: dir2/added
363 # Changes not staged for commit:
364 # (use "git add <file>..." to update what will be committed)
365 # (use "git checkout -- <file>..." to discard changes in working directory)
367 # modified: dir1/modified
369 # Untracked files not listed (use -u option to show untracked files)
371 test_expect_success
'status -uno' '
372 git status -uno >output &&
373 test_i18ncmp expect output
376 test_expect_success
'status (status.showUntrackedFiles no)' '
377 test_config status.showuntrackedfiles no &&
378 git status >output &&
379 test_i18ncmp expect output
384 # Changes to be committed:
385 # new file: dir2/added
387 # Changes not staged for commit:
388 # modified: dir1/modified
390 # Untracked files not listed
392 test_expect_success
'status -uno (advice.statusHints false)' '
393 test_config advice.statusHints false &&
394 git status -uno >output &&
395 test_i18ncmp expect output
402 test_expect_success
'status -s -uno' '
403 git status -s -uno >output &&
404 test_cmp expect output
407 test_expect_success
'status -s (status.showUntrackedFiles no)' '
408 git config status.showuntrackedfiles no
409 git status -s >output &&
410 test_cmp expect output
415 # Changes to be committed:
416 # (use "git reset HEAD <file>..." to unstage)
418 # new file: dir2/added
420 # Changes not staged for commit:
421 # (use "git add <file>..." to update what will be committed)
422 # (use "git checkout -- <file>..." to discard changes in working directory)
424 # modified: dir1/modified
427 # (use "git add <file>..." to include in what will be committed)
437 test_expect_success
'status -unormal' '
438 git status -unormal >output &&
439 test_i18ncmp expect output
442 test_expect_success
'status (status.showUntrackedFiles normal)' '
443 test_config status.showuntrackedfiles normal
444 git status >output &&
445 test_i18ncmp expect output
459 test_expect_success
'status -s -unormal' '
460 git status -s -unormal >output &&
461 test_cmp expect output
464 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
465 git config status.showuntrackedfiles normal
466 git status -s >output &&
467 test_cmp expect output
472 # Changes to be committed:
473 # (use "git reset HEAD <file>..." to unstage)
475 # new file: dir2/added
477 # Changes not staged for commit:
478 # (use "git add <file>..." to update what will be committed)
479 # (use "git checkout -- <file>..." to discard changes in working directory)
481 # modified: dir1/modified
484 # (use "git add <file>..." to include in what will be committed)
495 test_expect_success
'status -uall' '
496 git status -uall >output &&
497 test_i18ncmp expect output
500 test_expect_success
'status (status.showUntrackedFiles all)' '
501 test_config status.showuntrackedfiles all
502 git status >output &&
503 test_i18ncmp expect output
506 test_expect_success
'teardown dir3' '
520 test_expect_success
'status -s -uall' '
521 git config --unset status.showuntrackedfiles
522 git status -s -uall >output &&
523 test_cmp expect output
525 test_expect_success
'status -s (status.showUntrackedFiles all)' '
526 test_config status.showuntrackedfiles all &&
527 git status -s >output &&
529 test_cmp expect output
534 # Changes to be committed:
535 # (use "git reset HEAD <file>..." to unstage)
537 # new file: ../dir2/added
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)
546 # (use "git add <file>..." to include in what will be committed)
556 test_expect_success
'status with relative paths' '
557 (cd dir1 && git status) >output &&
558 test_i18ncmp expect output
571 test_expect_success
'status -s with relative paths' '
573 (cd dir1 && git status -s) >output &&
574 test_cmp expect output
589 test_expect_success
'status --porcelain ignores relative paths setting' '
591 (cd dir1 && git status --porcelain) >output &&
592 test_cmp expect output
596 test_expect_success
'setup unique colors' '
598 git config status.color.untracked blue &&
599 git config status.color.branch green
604 # On branch <GREEN>master<RESET>
605 # Changes to be committed:
606 # (use "git reset HEAD <file>..." to unstage)
608 # <GREEN>new file: dir2/added<RESET>
610 # Changes not staged for commit:
611 # (use "git add <file>..." to update what will be committed)
612 # (use "git checkout -- <file>..." to discard changes in working directory)
614 # <RED>modified: dir1/modified<RESET>
617 # (use "git add <file>..." to include in what will be committed)
619 # <BLUE>dir1/untracked<RESET>
620 # <BLUE>dir2/modified<RESET>
621 # <BLUE>dir2/untracked<RESET>
622 # <BLUE>expect<RESET>
623 # <BLUE>output<RESET>
624 # <BLUE>untracked<RESET>
627 test_expect_success
'status with color.ui' '
628 test_config color.ui always &&
629 git status | test_decode_color >output &&
630 test_i18ncmp expect output
633 test_expect_success
'status with color.status' '
634 test_config color.status always &&
635 git status | test_decode_color >output &&
636 test_i18ncmp expect output
640 <RED
>M
<RESET
> dir
1/modified
641 <GREEN
>A
<RESET
> dir
2/added
642 <BLUE
>??
<RESET
> dir
1/untracked
643 <BLUE
>??
<RESET
> dir
2/modified
644 <BLUE
>??
<RESET
> dir
2/untracked
645 <BLUE
>??
<RESET
> expect
646 <BLUE
>??
<RESET
> output
647 <BLUE
>??
<RESET
> untracked
650 test_expect_success
'status -s with color.ui' '
652 git config color.ui always &&
653 git status -s | test_decode_color >output &&
654 test_cmp expect output
658 test_expect_success
'status -s with color.status' '
660 git config --unset color.ui &&
661 git config color.status always &&
662 git status -s | test_decode_color >output &&
663 test_cmp expect output
668 ## <GREEN>master<RESET>
669 <RED
>M
<RESET
> dir
1/modified
670 <GREEN
>A
<RESET
> dir
2/added
671 <BLUE
>??
<RESET
> dir
1/untracked
672 <BLUE
>??
<RESET
> dir
2/modified
673 <BLUE
>??
<RESET
> dir
2/untracked
674 <BLUE
>??
<RESET
> expect
675 <BLUE
>??
<RESET
> output
676 <BLUE
>??
<RESET
> untracked
679 test_expect_success
'status -s -b with color.status' '
681 git status -s -b | test_decode_color >output &&
682 test_cmp expect output
697 test_expect_success
'status --porcelain ignores color.ui' '
699 git config --unset color.status &&
700 git config color.ui always &&
701 git status --porcelain | test_decode_color >output &&
702 test_cmp expect output
706 test_expect_success
'status --porcelain ignores color.status' '
708 git config --unset color.ui &&
709 git config color.status always &&
710 git status --porcelain | test_decode_color >output &&
711 test_cmp expect output
715 # recover unconditionally from color tests
716 git config
--unset color.status
717 git config
--unset color.ui
719 test_expect_success
'status --porcelain respects -b' '
721 git status --porcelain -b >output &&
727 test_cmp expect output
733 # Changes to be committed:
734 # (use "git reset HEAD <file>..." to unstage)
736 # new file: dir2/added
738 # Changes not staged for commit:
739 # (use "git add <file>..." to update what will be committed)
740 # (use "git checkout -- <file>..." to discard changes in working directory)
742 # modified: dir1/modified
745 # (use "git add <file>..." to include in what will be committed)
756 test_expect_success
'status without relative paths' '
758 test_config status.relativePaths false &&
759 (cd dir1 && git status) >output &&
760 test_i18ncmp expect output
775 test_expect_success
'status -s without relative paths' '
777 test_config status.relativePaths false &&
778 (cd dir1 && git status -s) >output &&
779 test_cmp expect output
785 # Changes to be committed:
786 # (use "git reset HEAD <file>..." to unstage)
788 # modified: dir1/modified
791 # (use "git add <file>..." to include in what will be committed)
799 test_expect_success
'dry-run of partial commit excluding new file in index' '
800 git commit --dry-run dir1/modified >output &&
801 test_i18ncmp expect output
805 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
807 test_expect_success
'status refreshes the index' '
810 git diff-files >output &&
811 test_cmp expect output
814 test_expect_success
'setup status submodule summary' '
815 test_create_repo sm && (
819 git commit -m "Add foo"
826 # Changes to be committed:
827 # (use "git reset HEAD <file>..." to unstage)
829 # new file: dir2/added
832 # Changes not staged for commit:
833 # (use "git add <file>..." to update what will be committed)
834 # (use "git checkout -- <file>..." to discard changes in working directory)
836 # modified: dir1/modified
839 # (use "git add <file>..." to include in what will be committed)
848 test_expect_success
'status submodule summary is disabled by default' '
849 git status >output &&
850 test_i18ncmp expect output
853 # we expect the same as the previous test
854 test_expect_success
'status --untracked-files=all does not show submodule' '
855 git status --untracked-files=all >output &&
856 test_i18ncmp expect output
870 test_expect_success
'status -s submodule summary is disabled by default' '
871 git status -s >output &&
872 test_cmp expect output
875 # we expect the same as the previous test
876 test_expect_success
'status -s --untracked-files=all does not show submodule' '
877 git status -s --untracked-files=all >output &&
878 test_cmp expect output
881 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
885 # Changes to be committed:
886 # (use "git reset HEAD <file>..." to unstage)
888 # new file: dir2/added
891 # Changes not staged for commit:
892 # (use "git add <file>..." to update what will be committed)
893 # (use "git checkout -- <file>..." to discard changes in working directory)
895 # modified: dir1/modified
897 # Submodule changes to be committed:
899 # * sm 0000000...$head (1):
903 # (use "git add <file>..." to include in what will be committed)
912 test_expect_success
'status submodule summary' '
913 git config status.submodulesummary 10 &&
914 git status >output &&
915 test_i18ncmp expect output
918 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
919 strip_comments expect &&
920 git -c status.displayCommentPrefix=false status >output &&
921 test_i18ncmp expect output
924 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
925 commit_template_commented
939 test_expect_success
'status -s submodule summary' '
940 git status -s >output &&
941 test_cmp expect output
946 # Changes not staged for commit:
947 # (use "git add <file>..." to update what will be committed)
948 # (use "git checkout -- <file>..." to discard changes in working directory)
950 # modified: dir1/modified
953 # (use "git add <file>..." to include in what will be committed)
961 no changes added to commit (use "git add" and/or "git commit -a")
963 test_expect_success
'status submodule summary (clean submodule): commit' '
964 git commit -m "commit submodule" &&
965 git config status.submodulesummary 10 &&
966 test_must_fail git commit --dry-run >output &&
967 test_i18ncmp expect output &&
968 git status >output &&
969 test_i18ncmp expect output
981 test_expect_success
'status -s submodule summary (clean submodule)' '
982 git status -s >output &&
983 test_cmp expect output
986 test_expect_success
'status -z implies porcelain' '
987 git status --porcelain |
988 "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
989 git status -z >output &&
990 test_cmp expect output
995 # Changes to be committed:
996 # (use "git reset HEAD^1 <file>..." to unstage)
998 # new file: dir2/added
1001 # Changes not staged for commit:
1002 # (use "git add <file>..." to update what will be committed)
1003 # (use "git checkout -- <file>..." to discard changes in working directory)
1005 # modified: dir1/modified
1007 # Submodule changes to be committed:
1009 # * sm 0000000...$head (1):
1013 # (use "git add <file>..." to include in what will be committed)
1022 test_expect_success
'commit --dry-run submodule summary (--amend)' '
1023 git config status.submodulesummary 10 &&
1024 git commit --dry-run --amend >output &&
1025 test_i18ncmp expect output
1028 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1031 # make dir1/tracked stat-dirty
1032 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1033 git status -s >output &&
1034 ! grep dir1/tracked output &&
1035 # make sure "status" succeeded without writing index out
1036 git diff-files | grep dir1/tracked
1043 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1044 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1049 # Changes to be committed:
1050 # (use "git reset HEAD <file>..." to unstage)
1054 # Changes not staged for commit:
1055 # (use "git add <file>..." to update what will be committed)
1056 # (use "git checkout -- <file>..." to discard changes in working directory)
1058 # modified: dir1/modified
1060 # Submodule changes to be committed:
1062 # * sm $head...$new_head (1):
1066 # (use "git add <file>..." to include in what will be committed)
1077 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1078 echo modified sm/untracked &&
1079 git status --ignore-submodules=untracked >output &&
1080 test_i18ncmp expect output
1083 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1084 test_config diff.ignoreSubmodules dirty &&
1085 git status >output &&
1086 test_i18ncmp expect output &&
1087 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1088 git config --add -f .gitmodules submodule.subname.path sm &&
1089 git status >output &&
1090 test_i18ncmp expect output &&
1091 git config -f .gitmodules --remove-section submodule.subname
1094 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1095 git config --add -f .gitmodules submodule.subname.ignore none &&
1096 git config --add -f .gitmodules submodule.subname.path sm &&
1097 git config --add submodule.subname.ignore untracked &&
1098 git config --add submodule.subname.path sm &&
1099 git status >output &&
1100 test_i18ncmp expect output &&
1101 git config --remove-section submodule.subname &&
1102 git config --remove-section -f .gitmodules submodule.subname
1105 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1106 git status --ignore-submodules=dirty >output &&
1107 test_i18ncmp expect output
1110 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1111 test_config diff.ignoreSubmodules dirty &&
1112 git status >output &&
1114 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1115 git config --add -f .gitmodules submodule.subname.path sm &&
1116 git status >output &&
1117 test_i18ncmp expect output &&
1118 git config -f .gitmodules --remove-section submodule.subname
1121 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1122 git config --add -f .gitmodules submodule.subname.ignore none &&
1123 git config --add -f .gitmodules submodule.subname.path sm &&
1124 git config --add submodule.subname.ignore dirty &&
1125 git config --add submodule.subname.path sm &&
1126 git status >output &&
1127 test_i18ncmp expect output &&
1128 git config --remove-section submodule.subname &&
1129 git config -f .gitmodules --remove-section submodule.subname
1132 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1133 echo modified >sm/foo &&
1134 git status --ignore-submodules=dirty >output &&
1135 test_i18ncmp expect output
1138 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1139 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1140 git config --add -f .gitmodules submodule.subname.path sm &&
1141 git status >output &&
1142 test_i18ncmp expect output &&
1143 git config -f .gitmodules --remove-section submodule.subname
1146 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1147 git config --add -f .gitmodules submodule.subname.ignore none &&
1148 git config --add -f .gitmodules submodule.subname.path sm &&
1149 git config --add submodule.subname.ignore dirty &&
1150 git config --add submodule.subname.path sm &&
1151 git status >output &&
1152 test_i18ncmp expect output &&
1153 git config --remove-section submodule.subname &&
1154 git config -f .gitmodules --remove-section submodule.subname
1159 # Changes to be committed:
1160 # (use "git reset HEAD <file>..." to unstage)
1164 # Changes not staged for commit:
1165 # (use "git add <file>..." to update what will be committed)
1166 # (use "git checkout -- <file>..." to discard changes in working directory)
1167 # (commit or discard the untracked or modified content in submodules)
1169 # modified: dir1/modified
1170 # modified: sm (modified content)
1172 # Submodule changes to be committed:
1174 # * sm $head...$new_head (1):
1178 # (use "git add <file>..." to include in what will be committed)
1189 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1190 git status --ignore-submodules=untracked > output &&
1191 test_i18ncmp expect output
1194 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1195 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1196 git config --add -f .gitmodules submodule.subname.path sm &&
1197 git status >output &&
1198 test_i18ncmp expect output &&
1199 git config -f .gitmodules --remove-section submodule.subname
1202 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1203 git config --add -f .gitmodules submodule.subname.ignore none &&
1204 git config --add -f .gitmodules submodule.subname.path sm &&
1205 git config --add submodule.subname.ignore untracked &&
1206 git config --add submodule.subname.path sm &&
1207 git status >output &&
1208 test_i18ncmp expect output &&
1209 git config --remove-section submodule.subname &&
1210 git config -f .gitmodules --remove-section submodule.subname
1213 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1217 # Changes to be committed:
1218 # (use "git reset HEAD <file>..." to unstage)
1222 # Changes not staged for commit:
1223 # (use "git add <file>..." to update what will be committed)
1224 # (use "git checkout -- <file>..." to discard changes in working directory)
1226 # modified: dir1/modified
1227 # modified: sm (new commits)
1229 # Submodule changes to be committed:
1231 # * sm $head...$new_head (1):
1234 # Submodules changed but not updated:
1236 # * sm $new_head...$head2 (1):
1240 # (use "git add <file>..." to include in what will be committed)
1251 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1252 git status --ignore-submodules=untracked > output &&
1253 test_i18ncmp expect output
1256 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1257 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1258 git config --add -f .gitmodules submodule.subname.path sm &&
1259 git status >output &&
1260 test_i18ncmp expect output &&
1261 git config -f .gitmodules --remove-section submodule.subname
1264 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1265 git config --add -f .gitmodules submodule.subname.ignore none &&
1266 git config --add -f .gitmodules submodule.subname.path sm &&
1267 git config --add submodule.subname.ignore untracked &&
1268 git config --add submodule.subname.path sm &&
1269 git status >output &&
1270 test_i18ncmp expect output &&
1271 git config --remove-section submodule.subname &&
1272 git config -f .gitmodules --remove-section submodule.subname
1275 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1276 git status --ignore-submodules=dirty > output &&
1277 test_i18ncmp expect output
1279 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1280 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1281 git config --add -f .gitmodules submodule.subname.path sm &&
1282 git status >output &&
1283 test_i18ncmp expect output &&
1284 git config -f .gitmodules --remove-section submodule.subname
1287 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1288 git config --add -f .gitmodules submodule.subname.ignore none &&
1289 git config --add -f .gitmodules submodule.subname.path sm &&
1290 git config --add submodule.subname.ignore dirty &&
1291 git config --add submodule.subname.path sm &&
1292 git status >output &&
1293 test_i18ncmp expect output &&
1294 git config --remove-section submodule.subname &&
1295 git config -f .gitmodules --remove-section submodule.subname
1300 ; Changes to be committed:
1301 ; (use "git reset HEAD <file>..." to unstage)
1305 ; Changes not staged for commit:
1306 ; (use "git add <file>..." to update what will be committed)
1307 ; (use "git checkout -- <file>..." to discard changes in working directory)
1309 ; modified: dir1/modified
1310 ; modified: sm (new commits)
1312 ; Submodule changes to be committed:
1314 ; * sm $head...$new_head (1):
1317 ; Submodules changed but not updated:
1319 ; * sm $new_head...$head2 (1):
1323 ; (use "git add <file>..." to include in what will be committed)
1334 test_expect_success
"status (core.commentchar with submodule summary)" '
1335 test_config core.commentchar ";" &&
1336 git status >output &&
1337 test_i18ncmp expect output
1340 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1341 test_config core.commentchar ";;" &&
1342 git status >output &&
1343 test_i18ncmp expect output
1348 # Changes not staged for commit:
1349 # (use "git add <file>..." to update what will be committed)
1350 # (use "git checkout -- <file>..." to discard changes in working directory)
1352 # modified: dir1/modified
1355 # (use "git add <file>..." to include in what will be committed)
1364 no changes added to commit (use "git add" and/or "git commit -a")
1367 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1368 git status --ignore-submodules=all > output &&
1369 test_i18ncmp expect output
1372 test_expect_failure
'.gitmodules ignore=all suppresses submodule summary' '
1373 git config --add -f .gitmodules submodule.subname.ignore all &&
1374 git config --add -f .gitmodules submodule.subname.path sm &&
1375 git status > output &&
1376 test_cmp expect output &&
1377 git config -f .gitmodules --remove-section submodule.subname
1380 test_expect_failure
'.git/config ignore=all suppresses submodule summary' '
1381 git config --add -f .gitmodules submodule.subname.ignore none &&
1382 git config --add -f .gitmodules submodule.subname.path sm &&
1383 git config --add submodule.subname.ignore all &&
1384 git config --add submodule.subname.path sm &&
1385 git status > output &&
1386 test_cmp expect output &&
1387 git config --remove-section submodule.subname &&
1388 git config -f .gitmodules --remove-section submodule.subname
1391 test_expect_success
'setup of test environment' '
1392 git config status.showUntrackedFiles no &&
1393 git status -s >expected_short &&
1394 git status --no-short >expected_noshort
1397 test_expect_success
'"status.short=true" same as "-s"' '
1398 git -c status.short=true status >actual &&
1399 test_cmp expected_short actual
1402 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1403 git -c status.short=true status --no-short >actual &&
1404 test_cmp expected_noshort actual
1407 test_expect_success
'"status.short=false" same as "--no-short"' '
1408 git -c status.short=false status >actual &&
1409 test_cmp expected_noshort actual
1412 test_expect_success
'"status.short=false" weaker than "-s"' '
1413 git -c status.short=false status -s >actual &&
1414 test_cmp expected_short actual
1417 test_expect_success
'"status.branch=true" same as "-b"' '
1418 git status -sb >expected_branch &&
1419 git -c status.branch=true status -s >actual &&
1420 test_cmp expected_branch actual
1423 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1424 git status -s --no-branch >expected_nobranch &&
1425 git -c status.branch=true status -s >actual &&
1426 test_must_fail test_cmp expected_nobranch actual
1429 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1430 git -c status.branch=true status -s --no-branch >actual &&
1431 test_cmp expected_nobranch actual
1434 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1435 git -c status.branch=true status --porcelain >actual &&
1436 test_cmp expected_nobranch actual
1439 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1440 git -c status.branch=false status -s >actual &&
1441 test_cmp expected_nobranch actual
1444 test_expect_success
'"status.branch=false" weaker than "-b"' '
1445 git -c status.branch=false status -sb >actual &&
1446 test_cmp expected_branch actual
1449 test_expect_success
'Restore default test environment' '
1450 git config --unset status.showUntrackedFiles