3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='git status'
10 test_expect_success
'status -h in broken repository' '
11 git config --global advice.statusuoption false &&
13 test_when_finished "rm -fr broken" &&
17 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
18 test_expect_code 129 git status -h >usage 2>&1
20 test_i18ngrep "[Uu]sage" broken/usage
23 test_expect_success
'commit -h in broken repository' '
25 test_when_finished "rm -fr broken" &&
29 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
30 test_expect_code 129 git commit -h >usage 2>&1
32 test_i18ngrep "[Uu]sage" broken/usage
35 test_expect_success
'setup' '
49 git commit -m initial &&
53 echo 1 >dir1/modified &&
54 echo 2 >dir2/modified &&
59 test_expect_success
'status (1)' '
60 test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
65 sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp
&&
66 rm "$1" && mv "$1".tmp
"$1"
69 test_expect_success
'status --column' '
72 # Changes to be committed:
73 # (use "git reset HEAD <file>..." to unstage)
75 # new file: dir2/added
77 # Changes not staged for commit:
78 # (use "git add <file>..." to update what will be committed)
79 # (use "git checkout -- <file>..." to discard changes in working directory)
81 # modified: dir1/modified
84 # (use "git add <file>..." to include in what will be committed)
86 # dir1/untracked dir2/untracked output
87 # dir2/modified expect untracked
90 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
91 test_i18ncmp expect output
94 test_expect_success
'status --column status.displayCommentPrefix=false' '
95 strip_comments expect &&
96 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
97 test_i18ncmp expect output
102 # Changes to be committed:
103 # (use "git reset HEAD <file>..." to unstage)
105 # new file: dir2/added
107 # Changes not staged for commit:
108 # (use "git add <file>..." to update what will be committed)
109 # (use "git checkout -- <file>..." to discard changes in working directory)
111 # modified: dir1/modified
114 # (use "git add <file>..." to include in what will be committed)
125 test_expect_success
'status with status.displayCommentPrefix=true' '
126 git -c status.displayCommentPrefix=true status >output &&
127 test_i18ncmp expect output
130 test_expect_success
'status with status.displayCommentPrefix=false' '
131 strip_comments expect &&
132 git -c status.displayCommentPrefix=false status >output &&
133 test_i18ncmp expect output
136 test_expect_success
'setup fake editor' '
137 cat >.git/editor <<-\EOF &&
141 chmod 755 .git/editor
144 commit_template_commented
() {
146 EDITOR
=.git
/editor
&&
148 # Fails due to empty message
149 test_must_fail git commit
151 ! grep '^[^#]' output
154 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
155 commit_template_commented
160 Changes to be committed
:
163 Changes not staged
for commit
:
164 modified
: dir
1/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)
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)
250 (use "git add -f <file>..." to include in what will be committed)
260 git status --ignored >output &&
261 test_i18ncmp expect output
264 test_expect_success
'status with gitignore (nothing untracked)' '
268 echo "dir2/modified" &&
273 cat >expect <<-\EOF &&
277 git status -s >output &&
278 test_cmp expect output &&
280 cat >expect <<-\EOF &&
291 git status -s --ignored >output &&
292 test_cmp expect output &&
294 cat >expect <<\EOF &&
296 Changes to be committed:
297 (use "git reset HEAD <file>..." to unstage)
301 Changes not staged for commit:
302 (use "git add <file>..." to update what will be committed)
303 (use "git checkout -- <file>..." to discard changes in working directory)
305 modified: dir1/modified
308 (use "git add -f <file>..." to include in what will be committed)
319 git status --ignored >output &&
320 test_i18ncmp expect output
337 test_expect_success
'status -s -b' '
339 git status -s -b >output &&
340 test_cmp expect output
344 test_expect_success
'status -s -z -b' '
345 tr "\\n" Q <expect >expect.q &&
346 mv expect.q expect &&
347 git status -s -z -b >output &&
348 nul_to_q <output >output.q &&
349 mv output.q output &&
350 test_cmp expect output
353 test_expect_success
'setup dir3' '
355 : >dir3/untracked1 &&
359 test_expect_success
'status -uno' '
362 Changes to be committed:
363 (use "git reset HEAD <file>..." to unstage)
367 Changes not staged for commit:
368 (use "git add <file>..." to update what will be committed)
369 (use "git checkout -- <file>..." to discard changes in working directory)
371 modified: dir1/modified
373 Untracked files not listed (use -u option to show untracked files)
375 git status -uno >output &&
376 test_i18ncmp expect output
379 test_expect_success
'status (status.showUntrackedFiles no)' '
380 test_config status.showuntrackedfiles no &&
381 git status >output &&
382 test_i18ncmp expect output
385 test_expect_success
'status -uno (advice.statusHints false)' '
388 Changes to be committed:
391 Changes not staged for commit:
392 modified: dir1/modified
394 Untracked files not listed
396 test_config advice.statusHints false &&
397 git status -uno >output &&
398 test_i18ncmp expect output
405 test_expect_success
'status -s -uno' '
406 git status -s -uno >output &&
407 test_cmp expect output
410 test_expect_success
'status -s (status.showUntrackedFiles no)' '
411 git config status.showuntrackedfiles no
412 git status -s >output &&
413 test_cmp expect output
416 test_expect_success
'status -unormal' '
419 Changes to be committed:
420 (use "git reset HEAD <file>..." to unstage)
424 Changes not staged for commit:
425 (use "git add <file>..." to update what will be committed)
426 (use "git checkout -- <file>..." to discard changes in working directory)
428 modified: dir1/modified
431 (use "git add <file>..." to include in what will be committed)
442 git status -unormal >output &&
443 test_i18ncmp expect output
446 test_expect_success
'status (status.showUntrackedFiles normal)' '
447 test_config status.showuntrackedfiles normal
448 git status >output &&
449 test_i18ncmp expect output
463 test_expect_success
'status -s -unormal' '
464 git status -s -unormal >output &&
465 test_cmp expect output
468 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
469 git config status.showuntrackedfiles normal
470 git status -s >output &&
471 test_cmp expect output
474 test_expect_success
'status -uall' '
477 Changes to be committed:
478 (use "git reset HEAD <file>..." to unstage)
482 Changes not staged for commit:
483 (use "git add <file>..." to update what will be committed)
484 (use "git checkout -- <file>..." to discard changes in working directory)
486 modified: dir1/modified
489 (use "git add <file>..." to include in what will be committed)
501 git status -uall >output &&
502 test_i18ncmp expect output
505 test_expect_success
'status (status.showUntrackedFiles all)' '
506 test_config status.showuntrackedfiles all
507 git status >output &&
508 test_i18ncmp expect output
511 test_expect_success
'teardown dir3' '
525 test_expect_success
'status -s -uall' '
526 git config --unset status.showuntrackedfiles
527 git status -s -uall >output &&
528 test_cmp expect output
530 test_expect_success
'status -s (status.showUntrackedFiles all)' '
531 test_config status.showuntrackedfiles all &&
532 git status -s >output &&
534 test_cmp expect output
537 test_expect_success
'status with relative paths' '
538 cat >expect <<\EOF &&
540 Changes to be committed:
541 (use "git reset HEAD <file>..." to unstage)
543 new file: ../dir2/added
545 Changes not staged for commit:
546 (use "git add <file>..." to update what will be committed)
547 (use "git checkout -- <file>..." to discard changes in working directory)
552 (use "git add <file>..." to include in what will be committed)
562 (cd dir1 && git status) >output &&
563 test_i18ncmp expect output
576 test_expect_success
'status -s with relative paths' '
578 (cd dir1 && git status -s) >output &&
579 test_cmp expect output
594 test_expect_success
'status --porcelain ignores relative paths setting' '
596 (cd dir1 && git status --porcelain) >output &&
597 test_cmp expect output
601 test_expect_success
'setup unique colors' '
603 git config status.color.untracked blue &&
604 git config status.color.branch green
608 test_expect_success
'status with color.ui' '
609 cat >expect <<\EOF &&
610 On branch <GREEN>master<RESET>
611 Changes to be committed:
612 (use "git reset HEAD <file>..." to unstage)
614 <GREEN>new file: dir2/added<RESET>
616 Changes not staged for commit:
617 (use "git add <file>..." to update what will be committed)
618 (use "git checkout -- <file>..." to discard changes in working directory)
620 <RED>modified: dir1/modified<RESET>
623 (use "git add <file>..." to include in what will be committed)
625 <BLUE>dir1/untracked<RESET>
626 <BLUE>dir2/modified<RESET>
627 <BLUE>dir2/untracked<RESET>
630 <BLUE>untracked<RESET>
633 test_config color.ui always &&
634 git status | test_decode_color >output &&
635 test_i18ncmp expect output
638 test_expect_success
'status with color.status' '
639 test_config color.status always &&
640 git status | test_decode_color >output &&
641 test_i18ncmp expect output
645 <RED
>M
<RESET
> dir
1/modified
646 <GREEN
>A
<RESET
> dir
2/added
647 <BLUE
>??
<RESET
> dir
1/untracked
648 <BLUE
>??
<RESET
> dir
2/modified
649 <BLUE
>??
<RESET
> dir
2/untracked
650 <BLUE
>??
<RESET
> expect
651 <BLUE
>??
<RESET
> output
652 <BLUE
>??
<RESET
> untracked
655 test_expect_success
'status -s with color.ui' '
657 git config color.ui always &&
658 git status -s | test_decode_color >output &&
659 test_cmp expect output
663 test_expect_success
'status -s with color.status' '
665 git config --unset color.ui &&
666 git config color.status always &&
667 git status -s | test_decode_color >output &&
668 test_cmp expect output
673 ## <GREEN>master<RESET>
674 <RED
>M
<RESET
> dir
1/modified
675 <GREEN
>A
<RESET
> dir
2/added
676 <BLUE
>??
<RESET
> dir
1/untracked
677 <BLUE
>??
<RESET
> dir
2/modified
678 <BLUE
>??
<RESET
> dir
2/untracked
679 <BLUE
>??
<RESET
> expect
680 <BLUE
>??
<RESET
> output
681 <BLUE
>??
<RESET
> untracked
684 test_expect_success
'status -s -b with color.status' '
686 git status -s -b | test_decode_color >output &&
687 test_cmp expect output
702 test_expect_success
'status --porcelain ignores color.ui' '
704 git config --unset color.status &&
705 git config color.ui always &&
706 git status --porcelain | test_decode_color >output &&
707 test_cmp expect output
711 test_expect_success
'status --porcelain ignores color.status' '
713 git config --unset color.ui &&
714 git config color.status always &&
715 git status --porcelain | test_decode_color >output &&
716 test_cmp expect output
720 # recover unconditionally from color tests
721 git config
--unset color.status
722 git config
--unset color.ui
724 test_expect_success
'status --porcelain respects -b' '
726 git status --porcelain -b >output &&
732 test_cmp expect output
738 test_expect_success
'status without relative paths' '
739 cat >expect <<\EOF &&
741 Changes to be committed:
742 (use "git reset HEAD <file>..." to unstage)
746 Changes not staged for commit:
747 (use "git add <file>..." to update what will be committed)
748 (use "git checkout -- <file>..." to discard changes in working directory)
750 modified: dir1/modified
753 (use "git add <file>..." to include in what will be committed)
763 test_config status.relativePaths false &&
764 (cd dir1 && git status) >output &&
765 test_i18ncmp expect output
780 test_expect_success
'status -s without relative paths' '
782 test_config status.relativePaths false &&
783 (cd dir1 && git status -s) >output &&
784 test_cmp expect output
788 test_expect_success
'dry-run of partial commit excluding new file in index' '
791 Changes to be committed:
792 (use "git reset HEAD <file>..." to unstage)
794 modified: dir1/modified
797 (use "git add <file>..." to include in what will be committed)
806 git commit --dry-run dir1/modified >output &&
807 test_i18ncmp expect output
811 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
813 test_expect_success
'status refreshes the index' '
816 git diff-files >output &&
817 test_cmp expect output
820 test_expect_success
'setup status submodule summary' '
821 test_create_repo sm && (
825 git commit -m "Add foo"
830 test_expect_success
'status submodule summary is disabled by default' '
833 Changes to be committed:
834 (use "git reset HEAD <file>..." to unstage)
839 Changes not staged for commit:
840 (use "git add <file>..." to update what will be committed)
841 (use "git checkout -- <file>..." to discard changes in working directory)
843 modified: dir1/modified
846 (use "git add <file>..." to include in what will be committed)
856 git status >output &&
857 test_i18ncmp expect output
860 # we expect the same as the previous test
861 test_expect_success
'status --untracked-files=all does not show submodule' '
862 git status --untracked-files=all >output &&
863 test_i18ncmp expect output
877 test_expect_success
'status -s submodule summary is disabled by default' '
878 git status -s >output &&
879 test_cmp expect output
882 # we expect the same as the previous test
883 test_expect_success
'status -s --untracked-files=all does not show submodule' '
884 git status -s --untracked-files=all >output &&
885 test_cmp expect output
888 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
890 test_expect_success
'status submodule summary' '
893 Changes to be committed:
894 (use "git reset HEAD <file>..." to unstage)
899 Changes not staged for commit:
900 (use "git add <file>..." to update what will be committed)
901 (use "git checkout -- <file>..." to discard changes in working directory)
903 modified: dir1/modified
905 Submodule changes to be committed:
907 * sm 0000000...$head (1):
911 (use "git add <file>..." to include in what will be committed)
921 git config status.submodulesummary 10 &&
922 git status >output &&
923 test_i18ncmp expect output
926 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
927 strip_comments expect &&
928 git -c status.displayCommentPrefix=false status >output &&
929 test_i18ncmp expect output
932 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
933 commit_template_commented
947 test_expect_success
'status -s submodule summary' '
948 git status -s >output &&
949 test_cmp expect output
952 test_expect_success
'status submodule summary (clean submodule): commit' '
955 Changes not staged for commit:
956 (use "git add <file>..." to update what will be committed)
957 (use "git checkout -- <file>..." to discard changes in working directory)
959 modified: dir1/modified
962 (use "git add <file>..." to include in what will be committed)
971 no changes added to commit (use "git add" and/or "git commit -a")
973 git commit -m "commit submodule" &&
974 git config status.submodulesummary 10 &&
975 test_must_fail git commit --dry-run >output &&
976 test_i18ncmp expect output &&
977 git status >output &&
978 test_i18ncmp expect output
990 test_expect_success
'status -s submodule summary (clean submodule)' '
991 git status -s >output &&
992 test_cmp expect output
995 test_expect_success
'status -z implies porcelain' '
996 git status --porcelain |
997 perl -pe "s/\012/\000/g" >expect &&
998 git status -z >output &&
999 test_cmp expect output
1002 test_expect_success
'commit --dry-run submodule summary (--amend)' '
1003 cat >expect <<EOF &&
1005 Changes to be committed:
1006 (use "git reset HEAD^1 <file>..." to unstage)
1008 new file: dir2/added
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 0000000...$head (1):
1023 (use "git add <file>..." to include in what will be committed)
1033 git config status.submodulesummary 10 &&
1034 git commit --dry-run --amend >output &&
1035 test_i18ncmp expect output
1038 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1041 # make dir1/tracked stat-dirty
1042 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1043 git status -s >output &&
1044 ! grep dir1/tracked output &&
1045 # make sure "status" succeeded without writing index out
1046 git diff-files | grep dir1/tracked
1053 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1054 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1057 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1058 cat > expect << EOF &&
1060 Changes to be committed:
1061 (use "git reset HEAD <file>..." to unstage)
1065 Changes not staged for commit:
1066 (use "git add <file>..." to update what will be committed)
1067 (use "git checkout -- <file>..." to discard changes in working directory)
1069 modified: dir1/modified
1071 Submodule changes to be committed:
1073 * sm $head...$new_head (1):
1077 (use "git add <file>..." to include in what will be committed)
1088 echo modified sm/untracked &&
1089 git status --ignore-submodules=untracked >output &&
1090 test_i18ncmp expect output
1093 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1094 test_config diff.ignoreSubmodules dirty &&
1095 git status >output &&
1096 test_i18ncmp expect output &&
1097 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1098 git config --add -f .gitmodules submodule.subname.path sm &&
1099 git status >output &&
1100 test_i18ncmp expect output &&
1101 git config -f .gitmodules --remove-section submodule.subname
1104 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1105 git config --add -f .gitmodules submodule.subname.ignore none &&
1106 git config --add -f .gitmodules submodule.subname.path sm &&
1107 git config --add submodule.subname.ignore untracked &&
1108 git config --add submodule.subname.path sm &&
1109 git status >output &&
1110 test_i18ncmp expect output &&
1111 git config --remove-section submodule.subname &&
1112 git config --remove-section -f .gitmodules submodule.subname
1115 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1116 git status --ignore-submodules=dirty >output &&
1117 test_i18ncmp expect output
1120 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1121 test_config diff.ignoreSubmodules dirty &&
1122 git status >output &&
1124 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1125 git config --add -f .gitmodules submodule.subname.path sm &&
1126 git status >output &&
1127 test_i18ncmp expect output &&
1128 git config -f .gitmodules --remove-section submodule.subname
1131 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1132 git config --add -f .gitmodules submodule.subname.ignore none &&
1133 git config --add -f .gitmodules submodule.subname.path sm &&
1134 git config --add submodule.subname.ignore dirty &&
1135 git config --add submodule.subname.path sm &&
1136 git status >output &&
1137 test_i18ncmp expect output &&
1138 git config --remove-section submodule.subname &&
1139 git config -f .gitmodules --remove-section submodule.subname
1142 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1143 echo modified >sm/foo &&
1144 git status --ignore-submodules=dirty >output &&
1145 test_i18ncmp expect output
1148 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1149 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1150 git config --add -f .gitmodules submodule.subname.path sm &&
1151 git status >output &&
1152 test_i18ncmp expect output &&
1153 git config -f .gitmodules --remove-section submodule.subname
1156 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1157 git config --add -f .gitmodules submodule.subname.ignore none &&
1158 git config --add -f .gitmodules submodule.subname.path sm &&
1159 git config --add submodule.subname.ignore dirty &&
1160 git config --add submodule.subname.path sm &&
1161 git status >output &&
1162 test_i18ncmp expect output &&
1163 git config --remove-section submodule.subname &&
1164 git config -f .gitmodules --remove-section submodule.subname
1167 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1168 cat > expect << EOF &&
1170 Changes to be committed:
1171 (use "git reset HEAD <file>..." to unstage)
1175 Changes not staged for commit:
1176 (use "git add <file>..." to update what will be committed)
1177 (use "git checkout -- <file>..." to discard changes in working directory)
1178 (commit or discard the untracked or modified content in submodules)
1180 modified: dir1/modified
1181 modified: sm (modified content)
1183 Submodule changes to be committed:
1185 * sm $head...$new_head (1):
1189 (use "git add <file>..." to include in what will be committed)
1200 git status --ignore-submodules=untracked > output &&
1201 test_i18ncmp expect output
1204 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1205 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1206 git config --add -f .gitmodules submodule.subname.path sm &&
1207 git status >output &&
1208 test_i18ncmp expect output &&
1209 git config -f .gitmodules --remove-section submodule.subname
1212 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1213 git config --add -f .gitmodules submodule.subname.ignore none &&
1214 git config --add -f .gitmodules submodule.subname.path sm &&
1215 git config --add submodule.subname.ignore untracked &&
1216 git config --add submodule.subname.path sm &&
1217 git status >output &&
1218 test_i18ncmp expect output &&
1219 git config --remove-section submodule.subname &&
1220 git config -f .gitmodules --remove-section submodule.subname
1223 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1225 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1226 cat > expect << EOF &&
1228 Changes to be committed:
1229 (use "git reset HEAD <file>..." to unstage)
1233 Changes not staged for commit:
1234 (use "git add <file>..." to update what will be committed)
1235 (use "git checkout -- <file>..." to discard changes in working directory)
1237 modified: dir1/modified
1238 modified: sm (new commits)
1240 Submodule changes to be committed:
1242 * sm $head...$new_head (1):
1245 Submodules changed but not updated:
1247 * sm $new_head...$head2 (1):
1251 (use "git add <file>..." to include in what will be committed)
1262 git status --ignore-submodules=untracked > output &&
1263 test_i18ncmp expect output
1266 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1267 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1268 git config --add -f .gitmodules submodule.subname.path sm &&
1269 git status >output &&
1270 test_i18ncmp expect output &&
1271 git config -f .gitmodules --remove-section submodule.subname
1274 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1275 git config --add -f .gitmodules submodule.subname.ignore none &&
1276 git config --add -f .gitmodules submodule.subname.path sm &&
1277 git config --add submodule.subname.ignore untracked &&
1278 git config --add submodule.subname.path sm &&
1279 git status >output &&
1280 test_i18ncmp expect output &&
1281 git config --remove-section submodule.subname &&
1282 git config -f .gitmodules --remove-section submodule.subname
1285 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1286 git status --ignore-submodules=dirty > output &&
1287 test_i18ncmp expect output
1289 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1290 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1291 git config --add -f .gitmodules submodule.subname.path sm &&
1292 git status >output &&
1293 test_i18ncmp expect output &&
1294 git config -f .gitmodules --remove-section submodule.subname
1297 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1298 git config --add -f .gitmodules submodule.subname.ignore none &&
1299 git config --add -f .gitmodules submodule.subname.path sm &&
1300 git config --add submodule.subname.ignore dirty &&
1301 git config --add submodule.subname.path sm &&
1302 git status >output &&
1303 test_i18ncmp expect output &&
1304 git config --remove-section submodule.subname &&
1305 git config -f .gitmodules --remove-section submodule.subname
1310 ; Changes to be committed:
1311 ; (use "git reset HEAD <file>..." to unstage)
1315 ; Changes not staged for commit:
1316 ; (use "git add <file>..." to update what will be committed)
1317 ; (use "git checkout -- <file>..." to discard changes in working directory)
1319 ; modified: dir1/modified
1320 ; modified: sm (new commits)
1322 ; Submodule changes to be committed:
1324 ; * sm $head...$new_head (1):
1327 ; Submodules changed but not updated:
1329 ; * sm $new_head...$head2 (1):
1333 ; (use "git add <file>..." to include in what will be committed)
1345 test_expect_success
"status (core.commentchar with submodule summary)" '
1346 test_config core.commentchar ";" &&
1347 git -c status.displayCommentPrefix=true status >output &&
1348 test_i18ncmp expect output
1351 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1352 test_config core.commentchar ";;" &&
1353 git -c status.displayCommentPrefix=true status >output &&
1354 test_i18ncmp expect output
1357 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1358 cat > expect << EOF &&
1360 Changes not staged for commit:
1361 (use "git add <file>..." to update what will be committed)
1362 (use "git checkout -- <file>..." to discard changes in working directory)
1364 modified: dir1/modified
1367 (use "git add <file>..." to include in what will be committed)
1377 no changes added to commit (use "git add" and/or "git commit -a")
1379 git status --ignore-submodules=all > output &&
1380 test_i18ncmp expect output
1383 test_expect_success
'.gitmodules ignore=all suppresses submodule summary' '
1384 git config --add -f .gitmodules submodule.subname.ignore all &&
1385 git config --add -f .gitmodules submodule.subname.path sm &&
1386 git status > output &&
1387 test_cmp expect output &&
1388 git config -f .gitmodules --remove-section submodule.subname
1391 test_expect_success
'.git/config ignore=all suppresses submodule summary' '
1392 git config --add -f .gitmodules submodule.subname.ignore none &&
1393 git config --add -f .gitmodules submodule.subname.path sm &&
1394 git config --add submodule.subname.ignore all &&
1395 git config --add submodule.subname.path sm &&
1396 git status > output &&
1397 test_cmp expect output &&
1398 git config --remove-section submodule.subname &&
1399 git config -f .gitmodules --remove-section submodule.subname
1402 test_expect_success
'setup of test environment' '
1403 git config status.showUntrackedFiles no &&
1404 git status -s >expected_short &&
1405 git status --no-short >expected_noshort
1408 test_expect_success
'"status.short=true" same as "-s"' '
1409 git -c status.short=true status >actual &&
1410 test_cmp expected_short actual
1413 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1414 git -c status.short=true status --no-short >actual &&
1415 test_cmp expected_noshort actual
1418 test_expect_success
'"status.short=false" same as "--no-short"' '
1419 git -c status.short=false status >actual &&
1420 test_cmp expected_noshort actual
1423 test_expect_success
'"status.short=false" weaker than "-s"' '
1424 git -c status.short=false status -s >actual &&
1425 test_cmp expected_short actual
1428 test_expect_success
'"status.branch=true" same as "-b"' '
1429 git status -sb >expected_branch &&
1430 git -c status.branch=true status -s >actual &&
1431 test_cmp expected_branch actual
1434 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1435 git status -s --no-branch >expected_nobranch &&
1436 git -c status.branch=true status -s >actual &&
1437 test_must_fail test_cmp expected_nobranch actual
1440 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1441 git -c status.branch=true status -s --no-branch >actual &&
1442 test_cmp expected_nobranch actual
1445 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1446 git -c status.branch=true status --porcelain >actual &&
1447 test_cmp expected_nobranch actual
1450 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1451 git -c status.branch=false status -s >actual &&
1452 test_cmp expected_nobranch actual
1455 test_expect_success
'"status.branch=false" weaker than "-b"' '
1456 git -c status.branch=false status -sb >actual &&
1457 test_cmp expected_branch actual
1460 test_expect_success
'Restore default test environment' '
1461 git config --unset status.showUntrackedFiles