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
64 sed "s/^\# //; s/^\#$//; s/^#\t/\t/" <"$1" >"$1".tmp
&&
65 rm "$1" && mv "$1".tmp
"$1"
68 test_expect_success
'status --column' '
71 # Changes to be committed:
72 # (use "git reset HEAD <file>..." to unstage)
74 # new file: dir2/added
76 # Changes not staged for commit:
77 # (use "git add <file>..." to update what will be committed)
78 # (use "git checkout -- <file>..." to discard changes in working directory)
80 # modified: dir1/modified
83 # (use "git add <file>..." to include in what will be committed)
85 # dir1/untracked dir2/untracked output
86 # dir2/modified expect untracked
89 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
90 test_i18ncmp expect output
93 test_expect_success
'status --column status.displayCommentPrefix=false' '
94 strip_comments expect &&
95 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
96 test_i18ncmp expect output
101 # Changes to be committed:
102 # (use "git reset HEAD <file>..." to unstage)
104 # new file: dir2/added
106 # Changes not staged for commit:
107 # (use "git add <file>..." to update what will be committed)
108 # (use "git checkout -- <file>..." to discard changes in working directory)
110 # modified: dir1/modified
113 # (use "git add <file>..." to include in what will be committed)
124 test_expect_success
'status with status.displayCommentPrefix=true' '
125 git -c status.displayCommentPrefix=true status >output &&
126 test_i18ncmp expect output
129 test_expect_success
'status with status.displayCommentPrefix=false' '
130 strip_comments expect &&
131 git -c status.displayCommentPrefix=false status >output &&
132 test_i18ncmp expect output
135 test_expect_success
'setup fake editor' '
136 cat >.git/editor <<-\EOF &&
140 chmod 755 .git/editor
143 commit_template_commented
() {
145 EDITOR
=.git
/editor
&&
147 # Fails due to empty message
148 test_must_fail git commit
150 ! grep '^[^#]' output
153 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
154 commit_template_commented
159 Changes to be committed
:
162 Changes not staged
for commit
:
163 modified
: dir
1/modified
175 test_expect_success
'status (advice.statusHints false)' '
176 test_config advice.statusHints false &&
177 git status >output &&
178 test_i18ncmp expect output
193 test_expect_success
'status -s' '
195 git status -s >output &&
196 test_cmp expect output
200 test_expect_success
'status with gitignore' '
208 cat >expect <<-\EOF &&
213 git status -s >output &&
214 test_cmp expect output &&
216 cat >expect <<-\EOF &&
227 git status -s --ignored >output &&
228 test_cmp expect output &&
230 cat >expect <<\EOF &&
232 Changes to be committed:
233 (use "git reset HEAD <file>..." to unstage)
237 Changes not staged for commit:
238 (use "git add <file>..." to update what will be committed)
239 (use "git checkout -- <file>..." to discard changes in working directory)
241 modified: dir1/modified
244 (use "git add <file>..." to include in what will be committed)
249 (use "git add -f <file>..." to include in what will be committed)
259 git status --ignored >output &&
260 test_i18ncmp expect output
263 test_expect_success
'status with gitignore (nothing untracked)' '
267 echo "dir2/modified" &&
272 cat >expect <<-\EOF &&
276 git status -s >output &&
277 test_cmp expect output &&
279 cat >expect <<-\EOF &&
290 git status -s --ignored >output &&
291 test_cmp expect output &&
293 cat >expect <<\EOF &&
295 Changes to be committed:
296 (use "git reset HEAD <file>..." to unstage)
300 Changes not staged for commit:
301 (use "git add <file>..." to update what will be committed)
302 (use "git checkout -- <file>..." to discard changes in working directory)
304 modified: dir1/modified
307 (use "git add -f <file>..." to include in what will be committed)
318 git status --ignored >output &&
319 test_i18ncmp expect output
336 test_expect_success
'status -s -b' '
338 git status -s -b >output &&
339 test_cmp expect output
343 test_expect_success
'status -s -z -b' '
344 tr "\\n" Q <expect >expect.q &&
345 mv expect.q expect &&
346 git status -s -z -b >output &&
347 nul_to_q <output >output.q &&
348 mv output.q output &&
349 test_cmp expect output
352 test_expect_success
'setup dir3' '
354 : >dir3/untracked1 &&
358 test_expect_success
'status -uno' '
361 Changes to be committed:
362 (use "git reset HEAD <file>..." to unstage)
366 Changes not staged for commit:
367 (use "git add <file>..." to update what will be committed)
368 (use "git checkout -- <file>..." to discard changes in working directory)
370 modified: dir1/modified
372 Untracked files not listed (use -u option to show untracked files)
374 git status -uno >output &&
375 test_i18ncmp expect output
378 test_expect_success
'status (status.showUntrackedFiles no)' '
379 test_config status.showuntrackedfiles no &&
380 git status >output &&
381 test_i18ncmp expect output
384 test_expect_success
'status -uno (advice.statusHints false)' '
387 Changes to be committed:
390 Changes not staged for commit:
391 modified: dir1/modified
393 Untracked files not listed
395 test_config advice.statusHints false &&
396 git status -uno >output &&
397 test_i18ncmp expect output
404 test_expect_success
'status -s -uno' '
405 git status -s -uno >output &&
406 test_cmp expect output
409 test_expect_success
'status -s (status.showUntrackedFiles no)' '
410 git config status.showuntrackedfiles no
411 git status -s >output &&
412 test_cmp expect output
415 test_expect_success
'status -unormal' '
418 Changes to be committed:
419 (use "git reset HEAD <file>..." to unstage)
423 Changes not staged for commit:
424 (use "git add <file>..." to update what will be committed)
425 (use "git checkout -- <file>..." to discard changes in working directory)
427 modified: dir1/modified
430 (use "git add <file>..." to include in what will be committed)
441 git status -unormal >output &&
442 test_i18ncmp expect output
445 test_expect_success
'status (status.showUntrackedFiles normal)' '
446 test_config status.showuntrackedfiles normal
447 git status >output &&
448 test_i18ncmp expect output
462 test_expect_success
'status -s -unormal' '
463 git status -s -unormal >output &&
464 test_cmp expect output
467 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
468 git config status.showuntrackedfiles normal
469 git status -s >output &&
470 test_cmp expect output
473 test_expect_success
'status -uall' '
476 Changes to be committed:
477 (use "git reset HEAD <file>..." to unstage)
481 Changes not staged for commit:
482 (use "git add <file>..." to update what will be committed)
483 (use "git checkout -- <file>..." to discard changes in working directory)
485 modified: dir1/modified
488 (use "git add <file>..." to include in what will be committed)
500 git status -uall >output &&
501 test_i18ncmp expect output
504 test_expect_success
'status (status.showUntrackedFiles all)' '
505 test_config status.showuntrackedfiles all
506 git status >output &&
507 test_i18ncmp expect output
510 test_expect_success
'teardown dir3' '
524 test_expect_success
'status -s -uall' '
525 git config --unset status.showuntrackedfiles
526 git status -s -uall >output &&
527 test_cmp expect output
529 test_expect_success
'status -s (status.showUntrackedFiles all)' '
530 test_config status.showuntrackedfiles all &&
531 git status -s >output &&
533 test_cmp expect output
536 test_expect_success
'status with relative paths' '
537 cat >expect <<\EOF &&
539 Changes to be committed:
540 (use "git reset HEAD <file>..." to unstage)
542 new file: ../dir2/added
544 Changes not staged for commit:
545 (use "git add <file>..." to update what will be committed)
546 (use "git checkout -- <file>..." to discard changes in working directory)
551 (use "git add <file>..." to include in what will be committed)
561 (cd dir1 && git status) >output &&
562 test_i18ncmp expect output
575 test_expect_success
'status -s with relative paths' '
577 (cd dir1 && git status -s) >output &&
578 test_cmp expect output
593 test_expect_success
'status --porcelain ignores relative paths setting' '
595 (cd dir1 && git status --porcelain) >output &&
596 test_cmp expect output
600 test_expect_success
'setup unique colors' '
602 git config status.color.untracked blue &&
603 git config status.color.branch green
607 test_expect_success
'status with color.ui' '
608 cat >expect <<\EOF &&
609 On branch <GREEN>master<RESET>
610 Changes to be committed:
611 (use "git reset HEAD <file>..." to unstage)
613 <GREEN>new file: dir2/added<RESET>
615 Changes not staged for commit:
616 (use "git add <file>..." to update what will be committed)
617 (use "git checkout -- <file>..." to discard changes in working directory)
619 <RED>modified: dir1/modified<RESET>
622 (use "git add <file>..." to include in what will be committed)
624 <BLUE>dir1/untracked<RESET>
625 <BLUE>dir2/modified<RESET>
626 <BLUE>dir2/untracked<RESET>
629 <BLUE>untracked<RESET>
632 test_config color.ui always &&
633 git status | test_decode_color >output &&
634 test_i18ncmp expect output
637 test_expect_success
'status with color.status' '
638 test_config color.status always &&
639 git status | test_decode_color >output &&
640 test_i18ncmp expect output
644 <RED
>M
<RESET
> dir
1/modified
645 <GREEN
>A
<RESET
> dir
2/added
646 <BLUE
>??
<RESET
> dir
1/untracked
647 <BLUE
>??
<RESET
> dir
2/modified
648 <BLUE
>??
<RESET
> dir
2/untracked
649 <BLUE
>??
<RESET
> expect
650 <BLUE
>??
<RESET
> output
651 <BLUE
>??
<RESET
> untracked
654 test_expect_success
'status -s with color.ui' '
656 git config color.ui always &&
657 git status -s | test_decode_color >output &&
658 test_cmp expect output
662 test_expect_success
'status -s with color.status' '
664 git config --unset color.ui &&
665 git config color.status always &&
666 git status -s | test_decode_color >output &&
667 test_cmp expect output
672 ## <GREEN>master<RESET>
673 <RED
>M
<RESET
> dir
1/modified
674 <GREEN
>A
<RESET
> dir
2/added
675 <BLUE
>??
<RESET
> dir
1/untracked
676 <BLUE
>??
<RESET
> dir
2/modified
677 <BLUE
>??
<RESET
> dir
2/untracked
678 <BLUE
>??
<RESET
> expect
679 <BLUE
>??
<RESET
> output
680 <BLUE
>??
<RESET
> untracked
683 test_expect_success
'status -s -b with color.status' '
685 git status -s -b | test_decode_color >output &&
686 test_cmp expect output
701 test_expect_success
'status --porcelain ignores color.ui' '
703 git config --unset color.status &&
704 git config color.ui always &&
705 git status --porcelain | test_decode_color >output &&
706 test_cmp expect output
710 test_expect_success
'status --porcelain ignores color.status' '
712 git config --unset color.ui &&
713 git config color.status always &&
714 git status --porcelain | test_decode_color >output &&
715 test_cmp expect output
719 # recover unconditionally from color tests
720 git config
--unset color.status
721 git config
--unset color.ui
723 test_expect_success
'status --porcelain respects -b' '
725 git status --porcelain -b >output &&
731 test_cmp expect output
737 test_expect_success
'status without relative paths' '
738 cat >expect <<\EOF &&
740 Changes to be committed:
741 (use "git reset HEAD <file>..." to unstage)
745 Changes not staged for commit:
746 (use "git add <file>..." to update what will be committed)
747 (use "git checkout -- <file>..." to discard changes in working directory)
749 modified: dir1/modified
752 (use "git add <file>..." to include in what will be committed)
762 test_config status.relativePaths false &&
763 (cd dir1 && git status) >output &&
764 test_i18ncmp expect output
779 test_expect_success
'status -s without relative paths' '
781 test_config status.relativePaths false &&
782 (cd dir1 && git status -s) >output &&
783 test_cmp expect output
787 test_expect_success
'dry-run of partial commit excluding new file in index' '
790 Changes to be committed:
791 (use "git reset HEAD <file>..." to unstage)
793 modified: dir1/modified
796 (use "git add <file>..." to include in what will be committed)
805 git commit --dry-run dir1/modified >output &&
806 test_i18ncmp expect output
810 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
812 test_expect_success
'status refreshes the index' '
815 git diff-files >output &&
816 test_cmp expect output
819 test_expect_success
'setup status submodule summary' '
820 test_create_repo sm && (
824 git commit -m "Add foo"
829 test_expect_success
'status submodule summary is disabled by default' '
832 Changes to be committed:
833 (use "git reset HEAD <file>..." to unstage)
838 Changes not staged for commit:
839 (use "git add <file>..." to update what will be committed)
840 (use "git checkout -- <file>..." to discard changes in working directory)
842 modified: dir1/modified
845 (use "git add <file>..." to include in what will be committed)
855 git status >output &&
856 test_i18ncmp expect output
859 # we expect the same as the previous test
860 test_expect_success
'status --untracked-files=all does not show submodule' '
861 git status --untracked-files=all >output &&
862 test_i18ncmp expect output
876 test_expect_success
'status -s submodule summary is disabled by default' '
877 git status -s >output &&
878 test_cmp expect output
881 # we expect the same as the previous test
882 test_expect_success
'status -s --untracked-files=all does not show submodule' '
883 git status -s --untracked-files=all >output &&
884 test_cmp expect output
887 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
889 test_expect_success
'status submodule summary' '
892 Changes to be committed:
893 (use "git reset HEAD <file>..." to unstage)
898 Changes not staged for commit:
899 (use "git add <file>..." to update what will be committed)
900 (use "git checkout -- <file>..." to discard changes in working directory)
902 modified: dir1/modified
904 Submodule changes to be committed:
906 * sm 0000000...$head (1):
910 (use "git add <file>..." to include in what will be committed)
920 git config status.submodulesummary 10 &&
921 git status >output &&
922 test_i18ncmp expect output
925 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
926 strip_comments expect &&
927 git -c status.displayCommentPrefix=false status >output &&
928 test_i18ncmp expect output
931 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
932 commit_template_commented
946 test_expect_success
'status -s submodule summary' '
947 git status -s >output &&
948 test_cmp expect output
951 test_expect_success
'status submodule summary (clean submodule): commit' '
954 Changes not staged for commit:
955 (use "git add <file>..." to update what will be committed)
956 (use "git checkout -- <file>..." to discard changes in working directory)
958 modified: dir1/modified
961 (use "git add <file>..." to include in what will be committed)
970 no changes added to commit (use "git add" and/or "git commit -a")
972 git commit -m "commit submodule" &&
973 git config status.submodulesummary 10 &&
974 test_must_fail git commit --dry-run >output &&
975 test_i18ncmp expect output &&
976 git status >output &&
977 test_i18ncmp expect output
989 test_expect_success
'status -s submodule summary (clean submodule)' '
990 git status -s >output &&
991 test_cmp expect output
994 test_expect_success
'status -z implies porcelain' '
995 git status --porcelain |
996 "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
997 git status -z >output &&
998 test_cmp expect output
1001 test_expect_success
'commit --dry-run submodule summary (--amend)' '
1002 cat >expect <<EOF &&
1004 Changes to be committed:
1005 (use "git reset HEAD^1 <file>..." to unstage)
1007 new file: dir2/added
1010 Changes not staged for commit:
1011 (use "git add <file>..." to update what will be committed)
1012 (use "git checkout -- <file>..." to discard changes in working directory)
1014 modified: dir1/modified
1016 Submodule changes to be committed:
1018 * sm 0000000...$head (1):
1022 (use "git add <file>..." to include in what will be committed)
1032 git config status.submodulesummary 10 &&
1033 git commit --dry-run --amend >output &&
1034 test_i18ncmp expect output
1037 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1040 # make dir1/tracked stat-dirty
1041 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1042 git status -s >output &&
1043 ! grep dir1/tracked output &&
1044 # make sure "status" succeeded without writing index out
1045 git diff-files | grep dir1/tracked
1052 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1053 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1056 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1057 cat > expect << EOF &&
1059 Changes to be committed:
1060 (use "git reset HEAD <file>..." to unstage)
1064 Changes not staged for commit:
1065 (use "git add <file>..." to update what will be committed)
1066 (use "git checkout -- <file>..." to discard changes in working directory)
1068 modified: dir1/modified
1070 Submodule changes to be committed:
1072 * sm $head...$new_head (1):
1076 (use "git add <file>..." to include in what will be committed)
1087 echo modified sm/untracked &&
1088 git status --ignore-submodules=untracked >output &&
1089 test_i18ncmp expect output
1092 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1093 test_config diff.ignoreSubmodules dirty &&
1094 git status >output &&
1095 test_i18ncmp expect output &&
1096 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1097 git config --add -f .gitmodules submodule.subname.path sm &&
1098 git status >output &&
1099 test_i18ncmp expect output &&
1100 git config -f .gitmodules --remove-section submodule.subname
1103 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1104 git config --add -f .gitmodules submodule.subname.ignore none &&
1105 git config --add -f .gitmodules submodule.subname.path sm &&
1106 git config --add submodule.subname.ignore untracked &&
1107 git config --add submodule.subname.path sm &&
1108 git status >output &&
1109 test_i18ncmp expect output &&
1110 git config --remove-section submodule.subname &&
1111 git config --remove-section -f .gitmodules submodule.subname
1114 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1115 git status --ignore-submodules=dirty >output &&
1116 test_i18ncmp expect output
1119 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1120 test_config diff.ignoreSubmodules dirty &&
1121 git status >output &&
1123 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1124 git config --add -f .gitmodules submodule.subname.path sm &&
1125 git status >output &&
1126 test_i18ncmp expect output &&
1127 git config -f .gitmodules --remove-section submodule.subname
1130 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1131 git config --add -f .gitmodules submodule.subname.ignore none &&
1132 git config --add -f .gitmodules submodule.subname.path sm &&
1133 git config --add submodule.subname.ignore dirty &&
1134 git config --add submodule.subname.path sm &&
1135 git status >output &&
1136 test_i18ncmp expect output &&
1137 git config --remove-section submodule.subname &&
1138 git config -f .gitmodules --remove-section submodule.subname
1141 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1142 echo modified >sm/foo &&
1143 git status --ignore-submodules=dirty >output &&
1144 test_i18ncmp expect output
1147 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1148 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1149 git config --add -f .gitmodules submodule.subname.path sm &&
1150 git status >output &&
1151 test_i18ncmp expect output &&
1152 git config -f .gitmodules --remove-section submodule.subname
1155 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1156 git config --add -f .gitmodules submodule.subname.ignore none &&
1157 git config --add -f .gitmodules submodule.subname.path sm &&
1158 git config --add submodule.subname.ignore dirty &&
1159 git config --add submodule.subname.path sm &&
1160 git status >output &&
1161 test_i18ncmp expect output &&
1162 git config --remove-section submodule.subname &&
1163 git config -f .gitmodules --remove-section submodule.subname
1166 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1167 cat > expect << EOF &&
1169 Changes to be committed:
1170 (use "git reset HEAD <file>..." to unstage)
1174 Changes not staged for commit:
1175 (use "git add <file>..." to update what will be committed)
1176 (use "git checkout -- <file>..." to discard changes in working directory)
1177 (commit or discard the untracked or modified content in submodules)
1179 modified: dir1/modified
1180 modified: sm (modified content)
1182 Submodule changes to be committed:
1184 * sm $head...$new_head (1):
1188 (use "git add <file>..." to include in what will be committed)
1199 git status --ignore-submodules=untracked > output &&
1200 test_i18ncmp expect output
1203 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1204 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1205 git config --add -f .gitmodules submodule.subname.path sm &&
1206 git status >output &&
1207 test_i18ncmp expect output &&
1208 git config -f .gitmodules --remove-section submodule.subname
1211 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1212 git config --add -f .gitmodules submodule.subname.ignore none &&
1213 git config --add -f .gitmodules submodule.subname.path sm &&
1214 git config --add submodule.subname.ignore untracked &&
1215 git config --add submodule.subname.path sm &&
1216 git status >output &&
1217 test_i18ncmp expect output &&
1218 git config --remove-section submodule.subname &&
1219 git config -f .gitmodules --remove-section submodule.subname
1222 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1224 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1225 cat > expect << EOF &&
1227 Changes to be committed:
1228 (use "git reset HEAD <file>..." to unstage)
1232 Changes not staged for commit:
1233 (use "git add <file>..." to update what will be committed)
1234 (use "git checkout -- <file>..." to discard changes in working directory)
1236 modified: dir1/modified
1237 modified: sm (new commits)
1239 Submodule changes to be committed:
1241 * sm $head...$new_head (1):
1244 Submodules changed but not updated:
1246 * sm $new_head...$head2 (1):
1250 (use "git add <file>..." to include in what will be committed)
1261 git status --ignore-submodules=untracked > output &&
1262 test_i18ncmp expect output
1265 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1266 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1267 git config --add -f .gitmodules submodule.subname.path sm &&
1268 git status >output &&
1269 test_i18ncmp expect output &&
1270 git config -f .gitmodules --remove-section submodule.subname
1273 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1274 git config --add -f .gitmodules submodule.subname.ignore none &&
1275 git config --add -f .gitmodules submodule.subname.path sm &&
1276 git config --add submodule.subname.ignore untracked &&
1277 git config --add submodule.subname.path sm &&
1278 git status >output &&
1279 test_i18ncmp expect output &&
1280 git config --remove-section submodule.subname &&
1281 git config -f .gitmodules --remove-section submodule.subname
1284 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1285 git status --ignore-submodules=dirty > output &&
1286 test_i18ncmp expect output
1288 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1289 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1290 git config --add -f .gitmodules submodule.subname.path sm &&
1291 git status >output &&
1292 test_i18ncmp expect output &&
1293 git config -f .gitmodules --remove-section submodule.subname
1296 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1297 git config --add -f .gitmodules submodule.subname.ignore none &&
1298 git config --add -f .gitmodules submodule.subname.path sm &&
1299 git config --add submodule.subname.ignore dirty &&
1300 git config --add submodule.subname.path sm &&
1301 git status >output &&
1302 test_i18ncmp expect output &&
1303 git config --remove-section submodule.subname &&
1304 git config -f .gitmodules --remove-section submodule.subname
1309 ; Changes to be committed:
1310 ; (use "git reset HEAD <file>..." to unstage)
1314 ; Changes not staged for commit:
1315 ; (use "git add <file>..." to update what will be committed)
1316 ; (use "git checkout -- <file>..." to discard changes in working directory)
1318 ; modified: dir1/modified
1319 ; modified: sm (new commits)
1321 ; Submodule changes to be committed:
1323 ; * sm $head...$new_head (1):
1326 ; Submodules changed but not updated:
1328 ; * sm $new_head...$head2 (1):
1332 ; (use "git add <file>..." to include in what will be committed)
1344 test_expect_success
"status (core.commentchar with submodule summary)" '
1345 test_config core.commentchar ";" &&
1346 git -c status.displayCommentPrefix=true status >output &&
1347 test_i18ncmp expect output
1350 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1351 test_config core.commentchar ";;" &&
1352 git -c status.displayCommentPrefix=true status >output &&
1353 test_i18ncmp expect output
1356 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1357 cat > expect << EOF &&
1359 Changes not staged for commit:
1360 (use "git add <file>..." to update what will be committed)
1361 (use "git checkout -- <file>..." to discard changes in working directory)
1363 modified: dir1/modified
1366 (use "git add <file>..." to include in what will be committed)
1376 no changes added to commit (use "git add" and/or "git commit -a")
1378 git status --ignore-submodules=all > output &&
1379 test_i18ncmp expect output
1382 test_expect_failure
'.gitmodules ignore=all suppresses submodule summary' '
1383 git config --add -f .gitmodules submodule.subname.ignore all &&
1384 git config --add -f .gitmodules submodule.subname.path sm &&
1385 git status > output &&
1386 test_cmp expect output &&
1387 git config -f .gitmodules --remove-section submodule.subname
1390 test_expect_failure
'.git/config ignore=all suppresses submodule summary' '
1391 git config --add -f .gitmodules submodule.subname.ignore none &&
1392 git config --add -f .gitmodules submodule.subname.path sm &&
1393 git config --add submodule.subname.ignore all &&
1394 git config --add submodule.subname.path sm &&
1395 git status > output &&
1396 test_cmp expect output &&
1397 git config --remove-section submodule.subname &&
1398 git config -f .gitmodules --remove-section submodule.subname
1401 test_expect_success
'setup of test environment' '
1402 git config status.showUntrackedFiles no &&
1403 git status -s >expected_short &&
1404 git status --no-short >expected_noshort
1407 test_expect_success
'"status.short=true" same as "-s"' '
1408 git -c status.short=true status >actual &&
1409 test_cmp expected_short actual
1412 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1413 git -c status.short=true status --no-short >actual &&
1414 test_cmp expected_noshort actual
1417 test_expect_success
'"status.short=false" same as "--no-short"' '
1418 git -c status.short=false status >actual &&
1419 test_cmp expected_noshort actual
1422 test_expect_success
'"status.short=false" weaker than "-s"' '
1423 git -c status.short=false status -s >actual &&
1424 test_cmp expected_short actual
1427 test_expect_success
'"status.branch=true" same as "-b"' '
1428 git status -sb >expected_branch &&
1429 git -c status.branch=true status -s >actual &&
1430 test_cmp expected_branch actual
1433 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1434 git status -s --no-branch >expected_nobranch &&
1435 git -c status.branch=true status -s >actual &&
1436 test_must_fail test_cmp expected_nobranch actual
1439 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1440 git -c status.branch=true status -s --no-branch >actual &&
1441 test_cmp expected_nobranch actual
1444 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1445 git -c status.branch=true status --porcelain >actual &&
1446 test_cmp expected_nobranch actual
1449 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1450 git -c status.branch=false status -s >actual &&
1451 test_cmp expected_nobranch actual
1454 test_expect_success
'"status.branch=false" weaker than "-b"' '
1455 git -c status.branch=false status -sb >actual &&
1456 test_cmp expected_branch actual
1459 test_expect_success
'Restore default test environment' '
1460 git config --unset status.showUntrackedFiles