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 test_expect_success
'status --column' '
76 # Changes to be committed:
77 # (use "git reset HEAD <file>..." to unstage)
79 # new file: dir2/added
81 # Changes not staged for commit:
82 # (use "git add <file>..." to update what will be committed)
83 # (use "git checkout -- <file>..." to discard changes in working directory)
85 # modified: dir1/modified
88 # (use "git add <file>..." to include in what will be committed)
90 # dir1/untracked dir2/untracked output
91 # dir2/modified expect untracked
94 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
95 test_i18ncmp expect output
98 test_expect_success
'status --column status.displayCommentPrefix=false' '
99 strip_comments expect &&
100 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
101 test_i18ncmp expect output
106 # Changes to be committed:
107 # (use "git reset HEAD <file>..." to unstage)
109 # new file: dir2/added
111 # Changes not staged for commit:
112 # (use "git add <file>..." to update what will be committed)
113 # (use "git checkout -- <file>..." to discard changes in working directory)
115 # modified: dir1/modified
118 # (use "git add <file>..." to include in what will be committed)
129 test_expect_success
'status with status.displayCommentPrefix=true' '
130 git -c status.displayCommentPrefix=true status >output &&
131 test_i18ncmp expect output
134 test_expect_success
'status with status.displayCommentPrefix=false' '
135 strip_comments expect &&
136 git -c status.displayCommentPrefix=false status >output &&
137 test_i18ncmp expect output
140 test_expect_success
'setup fake editor' '
141 cat >.git/editor <<-\EOF &&
145 chmod 755 .git/editor
148 commit_template_commented
() {
150 EDITOR
=.git
/editor
&&
152 # Fails due to empty message
153 test_must_fail git commit
155 ! grep '^[^#]' output
158 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
159 commit_template_commented
164 Changes to be committed
:
167 Changes not staged
for commit
:
168 modified
: dir
1/modified
180 test_expect_success
'status (advice.statusHints false)' '
181 test_config advice.statusHints false &&
182 git status >output &&
183 test_i18ncmp expect output
198 test_expect_success
'status -s' '
200 git status -s >output &&
201 test_cmp expect output
205 test_expect_success
'status with gitignore' '
213 cat >expect <<-\EOF &&
218 git status -s >output &&
219 test_cmp expect output &&
221 cat >expect <<-\EOF &&
232 git status -s --ignored >output &&
233 test_cmp expect output &&
235 cat >expect <<\EOF &&
237 Changes to be committed:
238 (use "git reset HEAD <file>..." to unstage)
242 Changes not staged for commit:
243 (use "git add <file>..." to update what will be committed)
244 (use "git checkout -- <file>..." to discard changes in working directory)
246 modified: dir1/modified
249 (use "git add <file>..." to include in what will be committed)
254 (use "git add -f <file>..." to include in what will be committed)
264 git status --ignored >output &&
265 test_i18ncmp expect output
268 test_expect_success
'status with gitignore (nothing untracked)' '
272 echo "dir2/modified" &&
277 cat >expect <<-\EOF &&
281 git status -s >output &&
282 test_cmp expect output &&
284 cat >expect <<-\EOF &&
295 git status -s --ignored >output &&
296 test_cmp expect output &&
298 cat >expect <<\EOF &&
300 Changes to be committed:
301 (use "git reset HEAD <file>..." to unstage)
305 Changes not staged for commit:
306 (use "git add <file>..." to update what will be committed)
307 (use "git checkout -- <file>..." to discard changes in working directory)
309 modified: dir1/modified
312 (use "git add -f <file>..." to include in what will be committed)
323 git status --ignored >output &&
324 test_i18ncmp expect output
341 test_expect_success
'status -s -b' '
343 git status -s -b >output &&
344 test_cmp expect output
348 test_expect_success
'status -s -z -b' '
349 tr "\\n" Q <expect >expect.q &&
350 mv expect.q expect &&
351 git status -s -z -b >output &&
352 nul_to_q <output >output.q &&
353 mv output.q output &&
354 test_cmp expect output
357 test_expect_success
'setup dir3' '
359 : >dir3/untracked1 &&
363 test_expect_success
'status -uno' '
366 Changes to be committed:
367 (use "git reset HEAD <file>..." to unstage)
371 Changes not staged for commit:
372 (use "git add <file>..." to update what will be committed)
373 (use "git checkout -- <file>..." to discard changes in working directory)
375 modified: dir1/modified
377 Untracked files not listed (use -u option to show untracked files)
379 git status -uno >output &&
380 test_i18ncmp expect output
383 test_expect_success
'status (status.showUntrackedFiles no)' '
384 test_config status.showuntrackedfiles no &&
385 git status >output &&
386 test_i18ncmp expect output
389 test_expect_success
'status -uno (advice.statusHints false)' '
392 Changes to be committed:
395 Changes not staged for commit:
396 modified: dir1/modified
398 Untracked files not listed
400 test_config advice.statusHints false &&
401 git status -uno >output &&
402 test_i18ncmp expect output
409 test_expect_success
'status -s -uno' '
410 git status -s -uno >output &&
411 test_cmp expect output
414 test_expect_success
'status -s (status.showUntrackedFiles no)' '
415 git config status.showuntrackedfiles no
416 git status -s >output &&
417 test_cmp expect output
420 test_expect_success
'status -unormal' '
423 Changes to be committed:
424 (use "git reset HEAD <file>..." to unstage)
428 Changes not staged for commit:
429 (use "git add <file>..." to update what will be committed)
430 (use "git checkout -- <file>..." to discard changes in working directory)
432 modified: dir1/modified
435 (use "git add <file>..." to include in what will be committed)
446 git status -unormal >output &&
447 test_i18ncmp expect output
450 test_expect_success
'status (status.showUntrackedFiles normal)' '
451 test_config status.showuntrackedfiles normal
452 git status >output &&
453 test_i18ncmp expect output
467 test_expect_success
'status -s -unormal' '
468 git status -s -unormal >output &&
469 test_cmp expect output
472 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
473 git config status.showuntrackedfiles normal
474 git status -s >output &&
475 test_cmp expect output
478 test_expect_success
'status -uall' '
481 Changes to be committed:
482 (use "git reset HEAD <file>..." to unstage)
486 Changes not staged for commit:
487 (use "git add <file>..." to update what will be committed)
488 (use "git checkout -- <file>..." to discard changes in working directory)
490 modified: dir1/modified
493 (use "git add <file>..." to include in what will be committed)
505 git status -uall >output &&
506 test_i18ncmp expect output
509 test_expect_success
'status (status.showUntrackedFiles all)' '
510 test_config status.showuntrackedfiles all
511 git status >output &&
512 test_i18ncmp expect output
515 test_expect_success
'teardown dir3' '
529 test_expect_success
'status -s -uall' '
530 git config --unset status.showuntrackedfiles
531 git status -s -uall >output &&
532 test_cmp expect output
534 test_expect_success
'status -s (status.showUntrackedFiles all)' '
535 test_config status.showuntrackedfiles all &&
536 git status -s >output &&
538 test_cmp expect output
541 test_expect_success
'status with relative paths' '
542 cat >expect <<\EOF &&
544 Changes to be committed:
545 (use "git reset HEAD <file>..." to unstage)
547 new file: ../dir2/added
549 Changes not staged for commit:
550 (use "git add <file>..." to update what will be committed)
551 (use "git checkout -- <file>..." to discard changes in working directory)
556 (use "git add <file>..." to include in what will be committed)
566 (cd dir1 && git status) >output &&
567 test_i18ncmp expect output
580 test_expect_success
'status -s with relative paths' '
582 (cd dir1 && git status -s) >output &&
583 test_cmp expect output
598 test_expect_success
'status --porcelain ignores relative paths setting' '
600 (cd dir1 && git status --porcelain) >output &&
601 test_cmp expect output
605 test_expect_success
'setup unique colors' '
607 git config status.color.untracked blue &&
608 git config status.color.branch green
612 test_expect_success
'status with color.ui' '
613 cat >expect <<\EOF &&
614 On branch <GREEN>master<RESET>
615 Changes to be committed:
616 (use "git reset HEAD <file>..." to unstage)
618 <GREEN>new file: dir2/added<RESET>
620 Changes not staged for commit:
621 (use "git add <file>..." to update what will be committed)
622 (use "git checkout -- <file>..." to discard changes in working directory)
624 <RED>modified: dir1/modified<RESET>
627 (use "git add <file>..." to include in what will be committed)
629 <BLUE>dir1/untracked<RESET>
630 <BLUE>dir2/modified<RESET>
631 <BLUE>dir2/untracked<RESET>
634 <BLUE>untracked<RESET>
637 test_config color.ui always &&
638 git status | test_decode_color >output &&
639 test_i18ncmp expect output
642 test_expect_success
'status with color.status' '
643 test_config color.status always &&
644 git status | test_decode_color >output &&
645 test_i18ncmp expect output
649 <RED
>M
<RESET
> dir
1/modified
650 <GREEN
>A
<RESET
> dir
2/added
651 <BLUE
>??
<RESET
> dir
1/untracked
652 <BLUE
>??
<RESET
> dir
2/modified
653 <BLUE
>??
<RESET
> dir
2/untracked
654 <BLUE
>??
<RESET
> expect
655 <BLUE
>??
<RESET
> output
656 <BLUE
>??
<RESET
> untracked
659 test_expect_success
'status -s with color.ui' '
661 git config color.ui always &&
662 git status -s | test_decode_color >output &&
663 test_cmp expect output
667 test_expect_success
'status -s with color.status' '
669 git config --unset color.ui &&
670 git config color.status always &&
671 git status -s | test_decode_color >output &&
672 test_cmp expect output
677 ## <GREEN>master<RESET>
678 <RED
>M
<RESET
> dir
1/modified
679 <GREEN
>A
<RESET
> dir
2/added
680 <BLUE
>??
<RESET
> dir
1/untracked
681 <BLUE
>??
<RESET
> dir
2/modified
682 <BLUE
>??
<RESET
> dir
2/untracked
683 <BLUE
>??
<RESET
> expect
684 <BLUE
>??
<RESET
> output
685 <BLUE
>??
<RESET
> untracked
688 test_expect_success
'status -s -b with color.status' '
690 git status -s -b | test_decode_color >output &&
691 test_cmp expect output
706 test_expect_success
'status --porcelain ignores color.ui' '
708 git config --unset color.status &&
709 git config color.ui always &&
710 git status --porcelain | test_decode_color >output &&
711 test_cmp expect output
715 test_expect_success
'status --porcelain ignores color.status' '
717 git config --unset color.ui &&
718 git config color.status always &&
719 git status --porcelain | test_decode_color >output &&
720 test_cmp expect output
724 # recover unconditionally from color tests
725 git config
--unset color.status
726 git config
--unset color.ui
728 test_expect_success
'status --porcelain respects -b' '
730 git status --porcelain -b >output &&
736 test_cmp expect output
742 test_expect_success
'status without relative paths' '
743 cat >expect <<\EOF &&
745 Changes to be committed:
746 (use "git reset HEAD <file>..." to unstage)
750 Changes not staged for commit:
751 (use "git add <file>..." to update what will be committed)
752 (use "git checkout -- <file>..." to discard changes in working directory)
754 modified: dir1/modified
757 (use "git add <file>..." to include in what will be committed)
767 test_config status.relativePaths false &&
768 (cd dir1 && git status) >output &&
769 test_i18ncmp expect output
784 test_expect_success
'status -s without relative paths' '
786 test_config status.relativePaths false &&
787 (cd dir1 && git status -s) >output &&
788 test_cmp expect output
792 test_expect_success
'dry-run of partial commit excluding new file in index' '
795 Changes to be committed:
796 (use "git reset HEAD <file>..." to unstage)
798 modified: dir1/modified
801 (use "git add <file>..." to include in what will be committed)
810 git commit --dry-run dir1/modified >output &&
811 test_i18ncmp expect output
815 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
817 test_expect_success
'status refreshes the index' '
820 git diff-files >output &&
821 test_cmp expect output
824 test_expect_success
'setup status submodule summary' '
825 test_create_repo sm && (
829 git commit -m "Add foo"
834 test_expect_success
'status submodule summary is disabled by default' '
837 Changes to be committed:
838 (use "git reset HEAD <file>..." to unstage)
843 Changes not staged for commit:
844 (use "git add <file>..." to update what will be committed)
845 (use "git checkout -- <file>..." to discard changes in working directory)
847 modified: dir1/modified
850 (use "git add <file>..." to include in what will be committed)
860 git status >output &&
861 test_i18ncmp expect output
864 # we expect the same as the previous test
865 test_expect_success
'status --untracked-files=all does not show submodule' '
866 git status --untracked-files=all >output &&
867 test_i18ncmp expect output
881 test_expect_success
'status -s submodule summary is disabled by default' '
882 git status -s >output &&
883 test_cmp expect output
886 # we expect the same as the previous test
887 test_expect_success
'status -s --untracked-files=all does not show submodule' '
888 git status -s --untracked-files=all >output &&
889 test_cmp expect output
892 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
894 test_expect_success
'status submodule summary' '
897 Changes to be committed:
898 (use "git reset HEAD <file>..." to unstage)
903 Changes not staged for commit:
904 (use "git add <file>..." to update what will be committed)
905 (use "git checkout -- <file>..." to discard changes in working directory)
907 modified: dir1/modified
909 Submodule changes to be committed:
911 * sm 0000000...$head (1):
915 (use "git add <file>..." to include in what will be committed)
925 git config status.submodulesummary 10 &&
926 git status >output &&
927 test_i18ncmp expect output
930 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
931 strip_comments expect &&
932 git -c status.displayCommentPrefix=false status >output &&
933 test_i18ncmp expect output
936 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
937 commit_template_commented
951 test_expect_success
'status -s submodule summary' '
952 git status -s >output &&
953 test_cmp expect output
956 test_expect_success
'status submodule summary (clean submodule): commit' '
959 Changes not staged for commit:
960 (use "git add <file>..." to update what will be committed)
961 (use "git checkout -- <file>..." to discard changes in working directory)
963 modified: dir1/modified
966 (use "git add <file>..." to include in what will be committed)
975 no changes added to commit (use "git add" and/or "git commit -a")
977 git commit -m "commit submodule" &&
978 git config status.submodulesummary 10 &&
979 test_must_fail git commit --dry-run >output &&
980 test_i18ncmp expect output &&
981 git status >output &&
982 test_i18ncmp expect output
994 test_expect_success
'status -s submodule summary (clean submodule)' '
995 git status -s >output &&
996 test_cmp expect output
999 test_expect_success
'status -z implies porcelain' '
1000 git status --porcelain |
1001 "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
1002 git status -z >output &&
1003 test_cmp expect output
1006 test_expect_success
'commit --dry-run submodule summary (--amend)' '
1007 cat >expect <<EOF &&
1009 Changes to be committed:
1010 (use "git reset HEAD^1 <file>..." to unstage)
1012 new file: dir2/added
1015 Changes not staged for commit:
1016 (use "git add <file>..." to update what will be committed)
1017 (use "git checkout -- <file>..." to discard changes in working directory)
1019 modified: dir1/modified
1021 Submodule changes to be committed:
1023 * sm 0000000...$head (1):
1027 (use "git add <file>..." to include in what will be committed)
1037 git config status.submodulesummary 10 &&
1038 git commit --dry-run --amend >output &&
1039 test_i18ncmp expect output
1042 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1045 # make dir1/tracked stat-dirty
1046 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1047 git status -s >output &&
1048 ! grep dir1/tracked output &&
1049 # make sure "status" succeeded without writing index out
1050 git diff-files | grep dir1/tracked
1057 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1058 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1061 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1062 cat > expect << EOF &&
1064 Changes to be committed:
1065 (use "git reset HEAD <file>..." to unstage)
1069 Changes not staged for commit:
1070 (use "git add <file>..." to update what will be committed)
1071 (use "git checkout -- <file>..." to discard changes in working directory)
1073 modified: dir1/modified
1075 Submodule changes to be committed:
1077 * sm $head...$new_head (1):
1081 (use "git add <file>..." to include in what will be committed)
1092 echo modified sm/untracked &&
1093 git status --ignore-submodules=untracked >output &&
1094 test_i18ncmp expect output
1097 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1098 test_config diff.ignoreSubmodules dirty &&
1099 git status >output &&
1100 test_i18ncmp expect output &&
1101 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1102 git config --add -f .gitmodules submodule.subname.path sm &&
1103 git status >output &&
1104 test_i18ncmp expect output &&
1105 git config -f .gitmodules --remove-section submodule.subname
1108 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1109 git config --add -f .gitmodules submodule.subname.ignore none &&
1110 git config --add -f .gitmodules submodule.subname.path sm &&
1111 git config --add submodule.subname.ignore untracked &&
1112 git config --add submodule.subname.path sm &&
1113 git status >output &&
1114 test_i18ncmp expect output &&
1115 git config --remove-section submodule.subname &&
1116 git config --remove-section -f .gitmodules submodule.subname
1119 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1120 git status --ignore-submodules=dirty >output &&
1121 test_i18ncmp expect output
1124 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1125 test_config diff.ignoreSubmodules dirty &&
1126 git status >output &&
1128 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1129 git config --add -f .gitmodules submodule.subname.path sm &&
1130 git status >output &&
1131 test_i18ncmp expect output &&
1132 git config -f .gitmodules --remove-section submodule.subname
1135 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1136 git config --add -f .gitmodules submodule.subname.ignore none &&
1137 git config --add -f .gitmodules submodule.subname.path sm &&
1138 git config --add submodule.subname.ignore dirty &&
1139 git config --add submodule.subname.path sm &&
1140 git status >output &&
1141 test_i18ncmp expect output &&
1142 git config --remove-section submodule.subname &&
1143 git config -f .gitmodules --remove-section submodule.subname
1146 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1147 echo modified >sm/foo &&
1148 git status --ignore-submodules=dirty >output &&
1149 test_i18ncmp expect output
1152 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1153 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1154 git config --add -f .gitmodules submodule.subname.path sm &&
1155 git status >output &&
1156 test_i18ncmp expect output &&
1157 git config -f .gitmodules --remove-section submodule.subname
1160 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1161 git config --add -f .gitmodules submodule.subname.ignore none &&
1162 git config --add -f .gitmodules submodule.subname.path sm &&
1163 git config --add submodule.subname.ignore dirty &&
1164 git config --add submodule.subname.path sm &&
1165 git status >output &&
1166 test_i18ncmp expect output &&
1167 git config --remove-section submodule.subname &&
1168 git config -f .gitmodules --remove-section submodule.subname
1171 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1172 cat > expect << EOF &&
1174 Changes to be committed:
1175 (use "git reset HEAD <file>..." to unstage)
1179 Changes not staged for commit:
1180 (use "git add <file>..." to update what will be committed)
1181 (use "git checkout -- <file>..." to discard changes in working directory)
1182 (commit or discard the untracked or modified content in submodules)
1184 modified: dir1/modified
1185 modified: sm (modified content)
1187 Submodule changes to be committed:
1189 * sm $head...$new_head (1):
1193 (use "git add <file>..." to include in what will be committed)
1204 git status --ignore-submodules=untracked > output &&
1205 test_i18ncmp expect output
1208 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1209 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1210 git config --add -f .gitmodules submodule.subname.path sm &&
1211 git status >output &&
1212 test_i18ncmp expect output &&
1213 git config -f .gitmodules --remove-section submodule.subname
1216 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1217 git config --add -f .gitmodules submodule.subname.ignore none &&
1218 git config --add -f .gitmodules submodule.subname.path sm &&
1219 git config --add submodule.subname.ignore untracked &&
1220 git config --add submodule.subname.path sm &&
1221 git status >output &&
1222 test_i18ncmp expect output &&
1223 git config --remove-section submodule.subname &&
1224 git config -f .gitmodules --remove-section submodule.subname
1227 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1229 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1230 cat > expect << EOF &&
1232 Changes to be committed:
1233 (use "git reset HEAD <file>..." to unstage)
1237 Changes not staged for commit:
1238 (use "git add <file>..." to update what will be committed)
1239 (use "git checkout -- <file>..." to discard changes in working directory)
1241 modified: dir1/modified
1242 modified: sm (new commits)
1244 Submodule changes to be committed:
1246 * sm $head...$new_head (1):
1249 Submodules changed but not updated:
1251 * sm $new_head...$head2 (1):
1255 (use "git add <file>..." to include in what will be committed)
1266 git status --ignore-submodules=untracked > output &&
1267 test_i18ncmp expect output
1270 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1271 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1272 git config --add -f .gitmodules submodule.subname.path sm &&
1273 git status >output &&
1274 test_i18ncmp expect output &&
1275 git config -f .gitmodules --remove-section submodule.subname
1278 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1279 git config --add -f .gitmodules submodule.subname.ignore none &&
1280 git config --add -f .gitmodules submodule.subname.path sm &&
1281 git config --add submodule.subname.ignore untracked &&
1282 git config --add submodule.subname.path sm &&
1283 git status >output &&
1284 test_i18ncmp expect output &&
1285 git config --remove-section submodule.subname &&
1286 git config -f .gitmodules --remove-section submodule.subname
1289 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1290 git status --ignore-submodules=dirty > output &&
1291 test_i18ncmp expect output
1293 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1294 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1295 git config --add -f .gitmodules submodule.subname.path sm &&
1296 git status >output &&
1297 test_i18ncmp expect output &&
1298 git config -f .gitmodules --remove-section submodule.subname
1301 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1302 git config --add -f .gitmodules submodule.subname.ignore none &&
1303 git config --add -f .gitmodules submodule.subname.path sm &&
1304 git config --add submodule.subname.ignore dirty &&
1305 git config --add submodule.subname.path sm &&
1306 git status >output &&
1307 test_i18ncmp expect output &&
1308 git config --remove-section submodule.subname &&
1309 git config -f .gitmodules --remove-section submodule.subname
1314 ; Changes to be committed:
1315 ; (use "git reset HEAD <file>..." to unstage)
1319 ; Changes not staged for commit:
1320 ; (use "git add <file>..." to update what will be committed)
1321 ; (use "git checkout -- <file>..." to discard changes in working directory)
1323 ; modified: dir1/modified
1324 ; modified: sm (new commits)
1326 ; Submodule changes to be committed:
1328 ; * sm $head...$new_head (1):
1331 ; Submodules changed but not updated:
1333 ; * sm $new_head...$head2 (1):
1337 ; (use "git add <file>..." to include in what will be committed)
1349 test_expect_success
"status (core.commentchar with submodule summary)" '
1350 test_config core.commentchar ";" &&
1351 git -c status.displayCommentPrefix=true status >output &&
1352 test_i18ncmp expect output
1355 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1356 test_config core.commentchar ";;" &&
1357 git -c status.displayCommentPrefix=true status >output &&
1358 test_i18ncmp expect output
1361 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1362 cat > expect << EOF &&
1364 Changes not staged for commit:
1365 (use "git add <file>..." to update what will be committed)
1366 (use "git checkout -- <file>..." to discard changes in working directory)
1368 modified: dir1/modified
1371 (use "git add <file>..." to include in what will be committed)
1381 no changes added to commit (use "git add" and/or "git commit -a")
1383 git status --ignore-submodules=all > output &&
1384 test_i18ncmp expect output
1387 test_expect_success
'.gitmodules ignore=all suppresses submodule summary' '
1388 git config --add -f .gitmodules submodule.subname.ignore all &&
1389 git config --add -f .gitmodules submodule.subname.path sm &&
1390 git status > output &&
1391 test_cmp expect output &&
1392 git config -f .gitmodules --remove-section submodule.subname
1395 test_expect_success
'.git/config ignore=all suppresses submodule summary' '
1396 git config --add -f .gitmodules submodule.subname.ignore none &&
1397 git config --add -f .gitmodules submodule.subname.path sm &&
1398 git config --add submodule.subname.ignore all &&
1399 git config --add submodule.subname.path sm &&
1400 git status > output &&
1401 test_cmp expect output &&
1402 git config --remove-section submodule.subname &&
1403 git config -f .gitmodules --remove-section submodule.subname
1406 test_expect_success
'setup of test environment' '
1407 git config status.showUntrackedFiles no &&
1408 git status -s >expected_short &&
1409 git status --no-short >expected_noshort
1412 test_expect_success
'"status.short=true" same as "-s"' '
1413 git -c status.short=true status >actual &&
1414 test_cmp expected_short actual
1417 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1418 git -c status.short=true status --no-short >actual &&
1419 test_cmp expected_noshort actual
1422 test_expect_success
'"status.short=false" same as "--no-short"' '
1423 git -c status.short=false status >actual &&
1424 test_cmp expected_noshort actual
1427 test_expect_success
'"status.short=false" weaker than "-s"' '
1428 git -c status.short=false status -s >actual &&
1429 test_cmp expected_short actual
1432 test_expect_success
'"status.branch=true" same as "-b"' '
1433 git status -sb >expected_branch &&
1434 git -c status.branch=true status -s >actual &&
1435 test_cmp expected_branch actual
1438 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1439 git status -s --no-branch >expected_nobranch &&
1440 git -c status.branch=true status -s >actual &&
1441 test_must_fail test_cmp expected_nobranch actual
1444 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1445 git -c status.branch=true status -s --no-branch >actual &&
1446 test_cmp expected_nobranch actual
1449 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1450 git -c status.branch=true status --porcelain >actual &&
1451 test_cmp expected_nobranch actual
1454 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1455 git -c status.branch=false status -s >actual &&
1456 test_cmp expected_nobranch actual
1459 test_expect_success
'"status.branch=false" weaker than "-b"' '
1460 git -c status.branch=false status -sb >actual &&
1461 test_cmp expected_branch actual
1464 test_expect_success
'Restore default test environment' '
1465 git config --unset status.showUntrackedFiles