3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='git status'
9 *MINGW
*) GIT_TEST_CMP
="diff -uw";;
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
69 sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp
&&
70 rm "$1" && mv "$1".tmp
"$1"
73 cat >.gitignore
<<\EOF
79 test_expect_success
'status --column' '
82 # Changes to be committed:
83 # (use "git reset HEAD <file>..." to unstage)
85 # new file: dir2/added
87 # Changes not staged for commit:
88 # (use "git add <file>..." to update what will be committed)
89 # (use "git checkout -- <file>..." to discard changes in working directory)
91 # modified: dir1/modified
94 # (use "git add <file>..." to include in what will be committed)
96 # dir1/untracked dir2/untracked
97 # dir2/modified untracked
100 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
101 test_i18ncmp expect output
104 test_expect_success
'status --column status.displayCommentPrefix=false' '
105 strip_comments expect &&
106 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
107 test_i18ncmp expect output
112 # Changes to be committed:
113 # (use "git reset HEAD <file>..." to unstage)
115 # new file: dir2/added
117 # Changes not staged for commit:
118 # (use "git add <file>..." to update what will be committed)
119 # (use "git checkout -- <file>..." to discard changes in working directory)
121 # modified: dir1/modified
124 # (use "git add <file>..." to include in what will be committed)
133 test_expect_success
'status with status.displayCommentPrefix=true' '
134 git -c status.displayCommentPrefix=true status >output &&
135 test_i18ncmp expect output
138 test_expect_success
'status with status.displayCommentPrefix=false' '
139 strip_comments expect &&
140 git -c status.displayCommentPrefix=false status >output &&
141 test_i18ncmp expect output
144 test_expect_success
'status -v' '
145 (cat expect && git diff --cached) >expect-with-v &&
146 git status -v >output &&
147 test_i18ncmp expect-with-v output
150 test_expect_success
'status -v -v' '
152 echo "Changes to be committed:" &&
153 git -c diff.mnemonicprefix=true diff --cached &&
154 echo "--------------------------------------------------" &&
155 echo "Changes not staged for commit:" &&
156 git -c diff.mnemonicprefix=true diff) >expect-with-v &&
157 git status -v -v >output &&
158 test_i18ncmp expect-with-v output
161 test_expect_success
'setup fake editor' '
162 cat >.git/editor <<-\EOF &&
166 chmod 755 .git/editor
169 commit_template_commented
() {
171 EDITOR
=.git
/editor
&&
173 # Fails due to empty message
174 test_must_fail git commit
176 ! grep '^[^#]' output
179 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
180 commit_template_commented
185 Changes to be committed
:
188 Changes not staged
for commit
:
189 modified
: dir
1/modified
199 test_expect_success
'status (advice.statusHints false)' '
200 test_config advice.statusHints false &&
201 git status >output &&
202 test_i18ncmp expect output
215 test_expect_success
'status -s' '
217 git status -s >output &&
218 test_cmp expect output
222 test_expect_success
'status with gitignore' '
230 cat >expect <<-\EOF &&
235 git status -s >output &&
236 test_cmp expect output &&
238 cat >expect <<-\EOF &&
250 git status -s --ignored >output &&
251 test_cmp expect output &&
253 cat >expect <<\EOF &&
255 Changes to be committed:
256 (use "git reset HEAD <file>..." to unstage)
260 Changes not staged for commit:
261 (use "git add <file>..." to update what will be committed)
262 (use "git checkout -- <file>..." to discard changes in working directory)
264 modified: dir1/modified
267 (use "git add <file>..." to include in what will be committed)
272 (use "git add -f <file>..." to include in what will be committed)
283 git status --ignored >output &&
284 test_i18ncmp expect output
287 test_expect_success
'status with gitignore (nothing untracked)' '
291 echo "dir2/modified" &&
296 cat >expect <<-\EOF &&
300 git status -s >output &&
301 test_cmp expect output &&
303 cat >expect <<-\EOF &&
315 git status -s --ignored >output &&
316 test_cmp expect output &&
318 cat >expect <<\EOF &&
320 Changes to be committed:
321 (use "git reset HEAD <file>..." to unstage)
325 Changes not staged for commit:
326 (use "git add <file>..." to update what will be committed)
327 (use "git checkout -- <file>..." to discard changes in working directory)
329 modified: dir1/modified
332 (use "git add -f <file>..." to include in what will be committed)
344 git status --ignored >output &&
345 test_i18ncmp expect output
348 cat >.gitignore
<<\EOF
364 test_expect_success
'status -s -b' '
366 git status -s -b >output &&
367 test_cmp expect output
371 test_expect_success
'status -s -z -b' '
372 tr "\\n" Q <expect >expect.q &&
373 mv expect.q expect &&
374 git status -s -z -b >output &&
375 nul_to_q <output >output.q &&
376 mv output.q output &&
377 test_cmp expect output
380 test_expect_success
'setup dir3' '
382 : >dir3/untracked1 &&
386 test_expect_success
'status -uno' '
389 Changes to be committed:
390 (use "git reset HEAD <file>..." to unstage)
394 Changes not staged for commit:
395 (use "git add <file>..." to update what will be committed)
396 (use "git checkout -- <file>..." to discard changes in working directory)
398 modified: dir1/modified
400 Untracked files not listed (use -u option to show untracked files)
402 git status -uno >output &&
403 test_i18ncmp expect output
406 test_expect_success
'status (status.showUntrackedFiles no)' '
407 test_config status.showuntrackedfiles no &&
408 git status >output &&
409 test_i18ncmp expect output
412 test_expect_success
'status -uno (advice.statusHints false)' '
415 Changes to be committed:
418 Changes not staged for commit:
419 modified: dir1/modified
421 Untracked files not listed
423 test_config advice.statusHints false &&
424 git status -uno >output &&
425 test_i18ncmp expect output
432 test_expect_success
'status -s -uno' '
433 git status -s -uno >output &&
434 test_cmp expect output
437 test_expect_success
'status -s (status.showUntrackedFiles no)' '
438 git config status.showuntrackedfiles no &&
439 git status -s >output &&
440 test_cmp expect output
443 test_expect_success
'status -unormal' '
446 Changes to be committed:
447 (use "git reset HEAD <file>..." to unstage)
451 Changes not staged for commit:
452 (use "git add <file>..." to update what will be committed)
453 (use "git checkout -- <file>..." to discard changes in working directory)
455 modified: dir1/modified
458 (use "git add <file>..." to include in what will be committed)
467 git status -unormal >output &&
468 test_i18ncmp expect output
471 test_expect_success
'status (status.showUntrackedFiles normal)' '
472 test_config status.showuntrackedfiles normal &&
473 git status >output &&
474 test_i18ncmp expect output
486 test_expect_success
'status -s -unormal' '
487 git status -s -unormal >output &&
488 test_cmp expect output
491 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
492 git config status.showuntrackedfiles normal &&
493 git status -s >output &&
494 test_cmp expect output
497 test_expect_success
'status -uall' '
500 Changes to be committed:
501 (use "git reset HEAD <file>..." to unstage)
505 Changes not staged for commit:
506 (use "git add <file>..." to update what will be committed)
507 (use "git checkout -- <file>..." to discard changes in working directory)
509 modified: dir1/modified
512 (use "git add <file>..." to include in what will be committed)
522 git status -uall >output &&
523 test_i18ncmp expect output
526 test_expect_success
'status (status.showUntrackedFiles all)' '
527 test_config status.showuntrackedfiles all &&
528 git status >output &&
529 test_i18ncmp expect output
532 test_expect_success
'teardown dir3' '
544 test_expect_success
'status -s -uall' '
545 test_unconfig status.showuntrackedfiles &&
546 git status -s -uall >output &&
547 test_cmp expect output
549 test_expect_success
'status -s (status.showUntrackedFiles all)' '
550 test_config status.showuntrackedfiles all &&
551 git status -s >output &&
553 test_cmp expect output
556 test_expect_success
'status with relative paths' '
557 cat >expect <<\EOF &&
559 Changes to be committed:
560 (use "git reset HEAD <file>..." to unstage)
562 new file: ../dir2/added
564 Changes not staged for commit:
565 (use "git add <file>..." to update what will be committed)
566 (use "git checkout -- <file>..." to discard changes in working directory)
571 (use "git add <file>..." to include in what will be committed)
579 (cd dir1 && git status) >output &&
580 test_i18ncmp expect output
591 test_expect_success
'status -s with relative paths' '
593 (cd dir1 && git status -s) >output &&
594 test_cmp expect output
607 test_expect_success
'status --porcelain ignores relative paths setting' '
609 (cd dir1 && git status --porcelain) >output &&
610 test_cmp expect output
614 test_expect_success
'setup unique colors' '
616 git config status.color.untracked blue &&
617 git config status.color.branch green
621 test_expect_success
'status with color.ui' '
622 cat >expect <<\EOF &&
623 On branch <GREEN>master<RESET>
624 Changes to be committed:
625 (use "git reset HEAD <file>..." to unstage)
627 <GREEN>new file: dir2/added<RESET>
629 Changes not staged for commit:
630 (use "git add <file>..." to update what will be committed)
631 (use "git checkout -- <file>..." to discard changes in working directory)
633 <RED>modified: dir1/modified<RESET>
636 (use "git add <file>..." to include in what will be committed)
638 <BLUE>dir1/untracked<RESET>
639 <BLUE>dir2/modified<RESET>
640 <BLUE>dir2/untracked<RESET>
641 <BLUE>untracked<RESET>
644 test_config color.ui always &&
645 git status | test_decode_color >output &&
646 test_i18ncmp expect output
649 test_expect_success
'status with color.status' '
650 test_config color.status always &&
651 git status | test_decode_color >output &&
652 test_i18ncmp expect output
656 <RED
>M
<RESET
> dir
1/modified
657 <GREEN
>A
<RESET
> dir
2/added
658 <BLUE
>??
<RESET
> dir
1/untracked
659 <BLUE
>??
<RESET
> dir
2/modified
660 <BLUE
>??
<RESET
> dir
2/untracked
661 <BLUE
>??
<RESET
> untracked
664 test_expect_success
'status -s with color.ui' '
666 git config color.ui always &&
667 git status -s | test_decode_color >output &&
668 test_cmp expect output
672 test_expect_success
'status -s with color.status' '
674 git config --unset color.ui &&
675 git config color.status always &&
676 git status -s | test_decode_color >output &&
677 test_cmp expect output
682 ## <GREEN>master<RESET>
683 <RED
>M
<RESET
> dir
1/modified
684 <GREEN
>A
<RESET
> dir
2/added
685 <BLUE
>??
<RESET
> dir
1/untracked
686 <BLUE
>??
<RESET
> dir
2/modified
687 <BLUE
>??
<RESET
> dir
2/untracked
688 <BLUE
>??
<RESET
> untracked
691 test_expect_success
'status -s -b with color.status' '
693 git status -s -b | test_decode_color >output &&
694 test_cmp expect output
707 test_expect_success
'status --porcelain ignores color.ui' '
709 git config --unset color.status &&
710 git config color.ui always &&
711 git status --porcelain | test_decode_color >output &&
712 test_cmp expect output
716 test_expect_success
'status --porcelain ignores color.status' '
718 git config --unset color.ui &&
719 git config color.status always &&
720 git status --porcelain | test_decode_color >output &&
721 test_cmp expect output
725 # recover unconditionally from color tests
726 git config
--unset color.status
727 git config
--unset color.ui
729 test_expect_success
'status --porcelain respects -b' '
731 git status --porcelain -b >output &&
737 test_cmp expect output
743 test_expect_success
'status without relative paths' '
744 cat >expect <<\EOF &&
746 Changes to be committed:
747 (use "git reset HEAD <file>..." to unstage)
751 Changes not staged for commit:
752 (use "git add <file>..." to update what will be committed)
753 (use "git checkout -- <file>..." to discard changes in working directory)
755 modified: dir1/modified
758 (use "git add <file>..." to include in what will be committed)
766 test_config status.relativePaths false &&
767 (cd dir1 && git status) >output &&
768 test_i18ncmp expect output
781 test_expect_success
'status -s without relative paths' '
783 test_config status.relativePaths false &&
784 (cd dir1 && git status -s) >output &&
785 test_cmp expect output
789 test_expect_success
'dry-run of partial commit excluding new file in index' '
792 Changes to be committed:
793 (use "git reset HEAD <file>..." to unstage)
795 modified: dir1/modified
798 (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)
853 git status >output &&
854 test_i18ncmp expect output
857 # we expect the same as the previous test
858 test_expect_success
'status --untracked-files=all does not show submodule' '
859 git status --untracked-files=all >output &&
860 test_i18ncmp expect output
872 test_expect_success
'status -s submodule summary is disabled by default' '
873 git status -s >output &&
874 test_cmp expect output
877 # we expect the same as the previous test
878 test_expect_success
'status -s --untracked-files=all does not show submodule' '
879 git status -s --untracked-files=all >output &&
880 test_cmp expect output
883 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
885 test_expect_success
'status submodule summary' '
888 Changes to be committed:
889 (use "git reset HEAD <file>..." to unstage)
894 Changes not staged for commit:
895 (use "git add <file>..." to update what will be committed)
896 (use "git checkout -- <file>..." to discard changes in working directory)
898 modified: dir1/modified
900 Submodule changes to be committed:
902 * sm 0000000...$head (1):
906 (use "git add <file>..." to include in what will be committed)
914 git config status.submodulesummary 10 &&
915 git status >output &&
916 test_i18ncmp expect output
919 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
920 strip_comments expect &&
921 git -c status.displayCommentPrefix=false status >output &&
922 test_i18ncmp expect output
925 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
926 commit_template_commented
938 test_expect_success
'status -s submodule summary' '
939 git status -s >output &&
940 test_cmp expect output
943 test_expect_success
'status submodule summary (clean submodule): commit' '
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)
960 no changes added to commit (use "git add" and/or "git commit -a")
962 git commit -m "commit submodule" &&
963 git config status.submodulesummary 10 &&
964 test_must_fail git commit --dry-run >output &&
965 test_i18ncmp expect output &&
966 git status >output &&
967 test_i18ncmp expect output
977 test_expect_success
'status -s submodule summary (clean submodule)' '
978 git status -s >output &&
979 test_cmp expect output
982 test_expect_success
'status -z implies porcelain' '
983 git status --porcelain |
984 perl -pe "s/\012/\000/g" >expect &&
985 git status -z >output &&
986 test_cmp expect output
989 test_expect_success
'commit --dry-run submodule summary (--amend)' '
992 Changes to be committed:
993 (use "git reset HEAD^1 <file>..." to unstage)
998 Changes not staged for commit:
999 (use "git add <file>..." to update what will be committed)
1000 (use "git checkout -- <file>..." to discard changes in working directory)
1002 modified: dir1/modified
1004 Submodule changes to be committed:
1006 * sm 0000000...$head (1):
1010 (use "git add <file>..." to include in what will be committed)
1018 git config status.submodulesummary 10 &&
1019 git commit --dry-run --amend >output &&
1020 test_i18ncmp expect output
1023 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1026 # make dir1/tracked stat-dirty
1027 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1028 git status -s >output &&
1029 ! grep dir1/tracked output &&
1030 # make sure "status" succeeded without writing index out
1031 git diff-files | grep dir1/tracked
1038 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1039 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1042 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1043 cat > expect << EOF &&
1045 Changes to be committed:
1046 (use "git reset HEAD <file>..." to unstage)
1050 Changes not staged for commit:
1051 (use "git add <file>..." to update what will be committed)
1052 (use "git checkout -- <file>..." to discard changes in working directory)
1054 modified: dir1/modified
1056 Submodule changes to be committed:
1058 * sm $head...$new_head (1):
1062 (use "git add <file>..." to include in what will be committed)
1071 echo modified sm/untracked &&
1072 git status --ignore-submodules=untracked >output &&
1073 test_i18ncmp expect output
1076 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1077 test_config diff.ignoreSubmodules dirty &&
1078 git status >output &&
1079 test_i18ncmp expect output &&
1080 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1081 git config --add -f .gitmodules submodule.subname.path sm &&
1082 git status >output &&
1083 test_i18ncmp expect output &&
1084 git config -f .gitmodules --remove-section submodule.subname
1087 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1088 git config --add -f .gitmodules submodule.subname.ignore none &&
1089 git config --add -f .gitmodules submodule.subname.path sm &&
1090 git config --add submodule.subname.ignore untracked &&
1091 git config --add submodule.subname.path sm &&
1092 git status >output &&
1093 test_i18ncmp expect output &&
1094 git config --remove-section submodule.subname &&
1095 git config --remove-section -f .gitmodules submodule.subname
1098 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1099 git status --ignore-submodules=dirty >output &&
1100 test_i18ncmp expect output
1103 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1104 test_config diff.ignoreSubmodules dirty &&
1105 git status >output &&
1107 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1108 git config --add -f .gitmodules submodule.subname.path sm &&
1109 git status >output &&
1110 test_i18ncmp expect output &&
1111 git config -f .gitmodules --remove-section submodule.subname
1114 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1115 git config --add -f .gitmodules submodule.subname.ignore none &&
1116 git config --add -f .gitmodules submodule.subname.path sm &&
1117 git config --add submodule.subname.ignore dirty &&
1118 git config --add submodule.subname.path sm &&
1119 git status >output &&
1120 test_i18ncmp expect output &&
1121 git config --remove-section submodule.subname &&
1122 git config -f .gitmodules --remove-section submodule.subname
1125 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1126 echo modified >sm/foo &&
1127 git status --ignore-submodules=dirty >output &&
1128 test_i18ncmp expect output
1131 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1132 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1133 git config --add -f .gitmodules submodule.subname.path sm &&
1134 git status >output &&
1135 test_i18ncmp expect output &&
1136 git config -f .gitmodules --remove-section submodule.subname
1139 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1140 git config --add -f .gitmodules submodule.subname.ignore none &&
1141 git config --add -f .gitmodules submodule.subname.path sm &&
1142 git config --add submodule.subname.ignore dirty &&
1143 git config --add submodule.subname.path sm &&
1144 git status >output &&
1145 test_i18ncmp expect output &&
1146 git config --remove-section submodule.subname &&
1147 git config -f .gitmodules --remove-section submodule.subname
1150 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1151 cat > expect << EOF &&
1153 Changes to be committed:
1154 (use "git reset HEAD <file>..." to unstage)
1158 Changes not staged for commit:
1159 (use "git add <file>..." to update what will be committed)
1160 (use "git checkout -- <file>..." to discard changes in working directory)
1161 (commit or discard the untracked or modified content in submodules)
1163 modified: dir1/modified
1164 modified: sm (modified content)
1166 Submodule changes to be committed:
1168 * sm $head...$new_head (1):
1172 (use "git add <file>..." to include in what will be committed)
1181 git status --ignore-submodules=untracked > output &&
1182 test_i18ncmp expect output
1185 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1186 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1187 git config --add -f .gitmodules submodule.subname.path sm &&
1188 git status >output &&
1189 test_i18ncmp expect output &&
1190 git config -f .gitmodules --remove-section submodule.subname
1193 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1194 git config --add -f .gitmodules submodule.subname.ignore none &&
1195 git config --add -f .gitmodules submodule.subname.path sm &&
1196 git config --add submodule.subname.ignore untracked &&
1197 git config --add submodule.subname.path sm &&
1198 git status >output &&
1199 test_i18ncmp expect output &&
1200 git config --remove-section submodule.subname &&
1201 git config -f .gitmodules --remove-section submodule.subname
1204 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1206 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1207 cat > expect << EOF &&
1209 Changes to be committed:
1210 (use "git reset HEAD <file>..." to unstage)
1214 Changes not staged for commit:
1215 (use "git add <file>..." to update what will be committed)
1216 (use "git checkout -- <file>..." to discard changes in working directory)
1218 modified: dir1/modified
1219 modified: sm (new commits)
1221 Submodule changes to be committed:
1223 * sm $head...$new_head (1):
1226 Submodules changed but not updated:
1228 * sm $new_head...$head2 (1):
1232 (use "git add <file>..." to include in what will be committed)
1241 git status --ignore-submodules=untracked > output &&
1242 test_i18ncmp expect output
1245 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1246 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1247 git config --add -f .gitmodules submodule.subname.path sm &&
1248 git status >output &&
1249 test_i18ncmp expect output &&
1250 git config -f .gitmodules --remove-section submodule.subname
1253 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1254 git config --add -f .gitmodules submodule.subname.ignore none &&
1255 git config --add -f .gitmodules submodule.subname.path sm &&
1256 git config --add submodule.subname.ignore untracked &&
1257 git config --add submodule.subname.path sm &&
1258 git status >output &&
1259 test_i18ncmp expect output &&
1260 git config --remove-section submodule.subname &&
1261 git config -f .gitmodules --remove-section submodule.subname
1264 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1265 git status --ignore-submodules=dirty > output &&
1266 test_i18ncmp expect output
1268 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1269 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1270 git config --add -f .gitmodules submodule.subname.path sm &&
1271 git status >output &&
1272 test_i18ncmp expect output &&
1273 git config -f .gitmodules --remove-section submodule.subname
1276 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1277 git config --add -f .gitmodules submodule.subname.ignore none &&
1278 git config --add -f .gitmodules submodule.subname.path sm &&
1279 git config --add submodule.subname.ignore dirty &&
1280 git config --add submodule.subname.path sm &&
1281 git status >output &&
1282 test_i18ncmp expect output &&
1283 git config --remove-section submodule.subname &&
1284 git config -f .gitmodules --remove-section submodule.subname
1289 ; Changes to be committed:
1290 ; (use "git reset HEAD <file>..." to unstage)
1294 ; Changes not staged for commit:
1295 ; (use "git add <file>..." to update what will be committed)
1296 ; (use "git checkout -- <file>..." to discard changes in working directory)
1298 ; modified: dir1/modified
1299 ; modified: sm (new commits)
1301 ; Submodule changes to be committed:
1303 ; * sm $head...$new_head (1):
1306 ; Submodules changed but not updated:
1308 ; * sm $new_head...$head2 (1):
1312 ; (use "git add <file>..." to include in what will be committed)
1322 test_expect_success
"status (core.commentchar with submodule summary)" '
1323 test_config core.commentchar ";" &&
1324 git -c status.displayCommentPrefix=true status >output &&
1325 test_i18ncmp expect output
1328 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1329 test_config core.commentchar ";;" &&
1330 test_must_fail git -c status.displayCommentPrefix=true status
1333 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1334 cat > expect << EOF &&
1336 Changes not staged for commit:
1337 (use "git add <file>..." to update what will be committed)
1338 (use "git checkout -- <file>..." to discard changes in working directory)
1340 modified: dir1/modified
1343 (use "git add <file>..." to include in what will be committed)
1351 no changes added to commit (use "git add" and/or "git commit -a")
1353 git status --ignore-submodules=all > output &&
1354 test_i18ncmp expect output
1357 test_expect_success
'.gitmodules ignore=all suppresses unstaged submodule summary' '
1358 cat > expect << EOF &&
1360 Changes to be committed:
1361 (use "git reset HEAD <file>..." to unstage)
1365 Changes not staged for commit:
1366 (use "git add <file>..." to update what will be committed)
1367 (use "git checkout -- <file>..." to discard changes in working directory)
1369 modified: dir1/modified
1372 (use "git add <file>..." to include in what will be committed)
1381 git config --add -f .gitmodules submodule.subname.ignore all &&
1382 git config --add -f .gitmodules submodule.subname.path sm &&
1383 git status > output &&
1384 test_cmp expect output &&
1385 git config -f .gitmodules --remove-section submodule.subname
1388 test_expect_success
'.git/config ignore=all suppresses unstaged submodule summary' '
1389 git config --add -f .gitmodules submodule.subname.ignore none &&
1390 git config --add -f .gitmodules submodule.subname.path sm &&
1391 git config --add submodule.subname.ignore all &&
1392 git config --add submodule.subname.path sm &&
1393 git status > output &&
1394 test_cmp expect output &&
1395 git config --remove-section submodule.subname &&
1396 git config -f .gitmodules --remove-section submodule.subname
1399 test_expect_success
'setup of test environment' '
1400 git config status.showUntrackedFiles no &&
1401 git status -s >expected_short &&
1402 git status --no-short >expected_noshort
1405 test_expect_success
'"status.short=true" same as "-s"' '
1406 git -c status.short=true status >actual &&
1407 test_cmp expected_short actual
1410 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1411 git -c status.short=true status --no-short >actual &&
1412 test_cmp expected_noshort actual
1415 test_expect_success
'"status.short=false" same as "--no-short"' '
1416 git -c status.short=false status >actual &&
1417 test_cmp expected_noshort actual
1420 test_expect_success
'"status.short=false" weaker than "-s"' '
1421 git -c status.short=false status -s >actual &&
1422 test_cmp expected_short actual
1425 test_expect_success
'"status.branch=true" same as "-b"' '
1426 git status -sb >expected_branch &&
1427 git -c status.branch=true status -s >actual &&
1428 test_cmp expected_branch actual
1431 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1432 git status -s --no-branch >expected_nobranch &&
1433 git -c status.branch=true status -s >actual &&
1434 test_must_fail test_cmp expected_nobranch actual
1437 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1438 git -c status.branch=true status -s --no-branch >actual &&
1439 test_cmp expected_nobranch actual
1442 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1443 git -c status.branch=true status --porcelain >actual &&
1444 test_cmp expected_nobranch actual
1447 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1448 git -c status.branch=false status -s >actual &&
1449 test_cmp expected_nobranch actual
1452 test_expect_success
'"status.branch=false" weaker than "-b"' '
1453 git -c status.branch=false status -sb >actual &&
1454 test_cmp expected_branch actual
1457 test_expect_success
'Restore default test environment' '
1458 git config --unset status.showUntrackedFiles
1461 test_expect_success
'git commit will commit a staged but ignored submodule' '
1462 git config --add -f .gitmodules submodule.subname.ignore all &&
1463 git config --add -f .gitmodules submodule.subname.path sm &&
1464 git config --add submodule.subname.ignore all &&
1465 git status -s --ignore-submodules=dirty >output &&
1466 test_i18ngrep "^M. sm" output &&
1467 GIT_EDITOR="echo hello >>\"\$1\"" &&
1468 export GIT_EDITOR &&
1470 git status -s --ignore-submodules=dirty >output &&
1471 test_i18ngrep ! "^M. sm" output
1474 test_expect_success
'git commit --dry-run will show a staged but ignored submodule' '
1477 cat >expect << EOF &&
1479 Changes to be committed:
1480 (use "git reset HEAD <file>..." to unstage)
1484 Changes not staged for commit:
1485 (use "git add <file>..." to update what will be committed)
1486 (use "git checkout -- <file>..." to discard changes in working directory)
1488 modified: dir1/modified
1490 Untracked files not listed (use -u option to show untracked files)
1492 git commit -uno --dry-run >output &&
1493 test_i18ncmp expect output &&
1494 git status -s --ignore-submodules=dirty >output &&
1495 test_i18ngrep "^M. sm" output
1498 test_expect_success
'git commit -m will commit a staged but ignored submodule' '
1499 git commit -uno -m message &&
1500 git status -s --ignore-submodules=dirty >output &&
1501 test_i18ngrep ! "^M. sm" output &&
1502 git config --remove-section submodule.subname &&
1503 git config -f .gitmodules --remove-section submodule.subname