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
88 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
89 test_i18ncmp expect output
92 test_expect_success
'status --column status.displayCommentPrefix=false' '
93 strip_comments expect &&
94 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
95 test_i18ncmp expect output
100 # Changes to be committed:
101 # (use "git reset HEAD <file>..." to unstage)
103 # new file: dir2/added
105 # Changes not staged for commit:
106 # (use "git add <file>..." to update what will be committed)
107 # (use "git checkout -- <file>..." to discard changes in working directory)
109 # modified: dir1/modified
112 # (use "git add <file>..." to include in what will be committed)
122 test_expect_success
'status with status.displayCommentPrefix=true' '
123 git -c status.displayCommentPrefix=true status >output &&
124 test_i18ncmp expect output
127 test_expect_success
'status with status.displayCommentPrefix=false' '
128 strip_comments expect &&
129 git -c status.displayCommentPrefix=false status >output &&
130 test_i18ncmp expect output
133 test_expect_success
'setup fake editor' '
134 cat >.git/editor <<-\EOF &&
138 chmod 755 .git/editor
141 commit_template_commented
() {
143 EDITOR
=.git
/editor
&&
145 # Fails due to empty message
146 test_must_fail git commit
148 ! grep '^[^#]' output
151 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
152 commit_template_commented
157 Changes to be committed
:
160 Changes not staged
for commit
:
161 modified
: dir
1/modified
172 test_expect_success
'status (advice.statusHints false)' '
173 test_config advice.statusHints false &&
174 git status >output &&
175 test_i18ncmp expect output
190 test_expect_success
'status -s' '
192 git status -s >output &&
193 test_cmp expect output
197 test_expect_success
'status with gitignore' '
205 cat >expect <<-\EOF &&
210 git status -s >output &&
211 test_cmp expect output &&
213 cat >expect <<-\EOF &&
224 git status -s --ignored >output &&
225 test_cmp expect output &&
227 cat >expect <<\EOF &&
229 Changes to be committed:
230 (use "git reset HEAD <file>..." to unstage)
234 Changes not staged for commit:
235 (use "git add <file>..." to update what will be committed)
236 (use "git checkout -- <file>..." to discard changes in working directory)
238 modified: dir1/modified
241 (use "git add <file>..." to include in what will be committed)
245 (use "git add -f <file>..." to include in what will be committed)
254 git status --ignored >output &&
255 test_i18ncmp expect output
258 test_expect_success
'status with gitignore (nothing untracked)' '
262 echo "dir2/modified" &&
267 cat >expect <<-\EOF &&
271 git status -s >output &&
272 test_cmp expect output &&
274 cat >expect <<-\EOF &&
285 git status -s --ignored >output &&
286 test_cmp expect output &&
288 cat >expect <<\EOF &&
290 Changes to be committed:
291 (use "git reset HEAD <file>..." to unstage)
295 Changes not staged for commit:
296 (use "git add <file>..." to update what will be committed)
297 (use "git checkout -- <file>..." to discard changes in working directory)
299 modified: dir1/modified
302 (use "git add -f <file>..." to include in what will be committed)
312 git status --ignored >output &&
313 test_i18ncmp expect output
330 test_expect_success
'status -s -b' '
332 git status -s -b >output &&
333 test_cmp expect output
337 test_expect_success
'status -s -z -b' '
338 tr "\\n" Q <expect >expect.q &&
339 mv expect.q expect &&
340 git status -s -z -b >output &&
341 nul_to_q <output >output.q &&
342 mv output.q output &&
343 test_cmp expect output
346 test_expect_success
'setup dir3' '
348 : >dir3/untracked1 &&
352 test_expect_success
'status -uno' '
355 Changes to be committed:
356 (use "git reset HEAD <file>..." to unstage)
360 Changes not staged for commit:
361 (use "git add <file>..." to update what will be committed)
362 (use "git checkout -- <file>..." to discard changes in working directory)
364 modified: dir1/modified
366 Untracked files not listed (use -u option to show untracked files)
368 git status -uno >output &&
369 test_i18ncmp expect output
372 test_expect_success
'status (status.showUntrackedFiles no)' '
373 test_config status.showuntrackedfiles no &&
374 git status >output &&
375 test_i18ncmp expect output
378 test_expect_success
'status -uno (advice.statusHints false)' '
381 Changes to be committed:
384 Changes not staged for commit:
385 modified: dir1/modified
387 Untracked files not listed
389 test_config advice.statusHints false &&
390 git status -uno >output &&
391 test_i18ncmp expect output
398 test_expect_success
'status -s -uno' '
399 git status -s -uno >output &&
400 test_cmp expect output
403 test_expect_success
'status -s (status.showUntrackedFiles no)' '
404 git config status.showuntrackedfiles no
405 git status -s >output &&
406 test_cmp expect output
409 test_expect_success
'status -unormal' '
412 Changes to be committed:
413 (use "git reset HEAD <file>..." to unstage)
417 Changes not staged for commit:
418 (use "git add <file>..." to update what will be committed)
419 (use "git checkout -- <file>..." to discard changes in working directory)
421 modified: dir1/modified
424 (use "git add <file>..." to include in what will be committed)
434 git status -unormal >output &&
435 test_i18ncmp expect output
438 test_expect_success
'status (status.showUntrackedFiles normal)' '
439 test_config status.showuntrackedfiles normal
440 git status >output &&
441 test_i18ncmp expect output
455 test_expect_success
'status -s -unormal' '
456 git status -s -unormal >output &&
457 test_cmp expect output
460 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
461 git config status.showuntrackedfiles normal
462 git status -s >output &&
463 test_cmp expect output
466 test_expect_success
'status -uall' '
469 Changes to be committed:
470 (use "git reset HEAD <file>..." to unstage)
474 Changes not staged for commit:
475 (use "git add <file>..." to update what will be committed)
476 (use "git checkout -- <file>..." to discard changes in working directory)
478 modified: dir1/modified
481 (use "git add <file>..." to include in what will be committed)
492 git status -uall >output &&
493 test_i18ncmp expect output
496 test_expect_success
'status (status.showUntrackedFiles all)' '
497 test_config status.showuntrackedfiles all
498 git status >output &&
499 test_i18ncmp expect output
502 test_expect_success
'teardown dir3' '
516 test_expect_success
'status -s -uall' '
517 git config --unset status.showuntrackedfiles
518 git status -s -uall >output &&
519 test_cmp expect output
521 test_expect_success
'status -s (status.showUntrackedFiles all)' '
522 test_config status.showuntrackedfiles all &&
523 git status -s >output &&
525 test_cmp expect output
528 test_expect_success
'status with relative paths' '
529 cat >expect <<\EOF &&
531 Changes to be committed:
532 (use "git reset HEAD <file>..." to unstage)
534 new file: ../dir2/added
536 Changes not staged for commit:
537 (use "git add <file>..." to update what will be committed)
538 (use "git checkout -- <file>..." to discard changes in working directory)
543 (use "git add <file>..." to include in what will be committed)
552 (cd dir1 && git status) >output &&
553 test_i18ncmp expect output
566 test_expect_success
'status -s with relative paths' '
568 (cd dir1 && git status -s) >output &&
569 test_cmp expect output
584 test_expect_success
'status --porcelain ignores relative paths setting' '
586 (cd dir1 && git status --porcelain) >output &&
587 test_cmp expect output
591 test_expect_success
'setup unique colors' '
593 git config status.color.untracked blue &&
594 git config status.color.branch green
598 test_expect_success
'status with color.ui' '
599 cat >expect <<\EOF &&
600 On branch <GREEN>master<RESET>
601 Changes to be committed:
602 (use "git reset HEAD <file>..." to unstage)
604 <GREEN>new file: dir2/added<RESET>
606 Changes not staged for commit:
607 (use "git add <file>..." to update what will be committed)
608 (use "git checkout -- <file>..." to discard changes in working directory)
610 <RED>modified: dir1/modified<RESET>
613 (use "git add <file>..." to include in what will be committed)
615 <BLUE>dir1/untracked<RESET>
616 <BLUE>dir2/modified<RESET>
617 <BLUE>dir2/untracked<RESET>
620 <BLUE>untracked<RESET>
622 test_config color.ui always &&
623 git status | test_decode_color >output &&
624 test_i18ncmp expect output
627 test_expect_success
'status with color.status' '
628 test_config color.status always &&
629 git status | test_decode_color >output &&
630 test_i18ncmp expect output
634 <RED
>M
<RESET
> dir
1/modified
635 <GREEN
>A
<RESET
> dir
2/added
636 <BLUE
>??
<RESET
> dir
1/untracked
637 <BLUE
>??
<RESET
> dir
2/modified
638 <BLUE
>??
<RESET
> dir
2/untracked
639 <BLUE
>??
<RESET
> expect
640 <BLUE
>??
<RESET
> output
641 <BLUE
>??
<RESET
> untracked
644 test_expect_success
'status -s with color.ui' '
646 git config color.ui always &&
647 git status -s | test_decode_color >output &&
648 test_cmp expect output
652 test_expect_success
'status -s with color.status' '
654 git config --unset color.ui &&
655 git config color.status always &&
656 git status -s | test_decode_color >output &&
657 test_cmp expect output
662 ## <GREEN>master<RESET>
663 <RED
>M
<RESET
> dir
1/modified
664 <GREEN
>A
<RESET
> dir
2/added
665 <BLUE
>??
<RESET
> dir
1/untracked
666 <BLUE
>??
<RESET
> dir
2/modified
667 <BLUE
>??
<RESET
> dir
2/untracked
668 <BLUE
>??
<RESET
> expect
669 <BLUE
>??
<RESET
> output
670 <BLUE
>??
<RESET
> untracked
673 test_expect_success
'status -s -b with color.status' '
675 git status -s -b | test_decode_color >output &&
676 test_cmp expect output
691 test_expect_success
'status --porcelain ignores color.ui' '
693 git config --unset color.status &&
694 git config color.ui always &&
695 git status --porcelain | test_decode_color >output &&
696 test_cmp expect output
700 test_expect_success
'status --porcelain ignores color.status' '
702 git config --unset color.ui &&
703 git config color.status always &&
704 git status --porcelain | test_decode_color >output &&
705 test_cmp expect output
709 # recover unconditionally from color tests
710 git config
--unset color.status
711 git config
--unset color.ui
713 test_expect_success
'status --porcelain respects -b' '
715 git status --porcelain -b >output &&
721 test_cmp expect output
727 test_expect_success
'status without relative paths' '
728 cat >expect <<\EOF &&
730 Changes to be committed:
731 (use "git reset HEAD <file>..." to unstage)
735 Changes not staged for commit:
736 (use "git add <file>..." to update what will be committed)
737 (use "git checkout -- <file>..." to discard changes in working directory)
739 modified: dir1/modified
742 (use "git add <file>..." to include in what will be committed)
751 test_config status.relativePaths false &&
752 (cd dir1 && git status) >output &&
753 test_i18ncmp expect output
768 test_expect_success
'status -s without relative paths' '
770 test_config status.relativePaths false &&
771 (cd dir1 && git status -s) >output &&
772 test_cmp expect output
776 test_expect_success
'dry-run of partial commit excluding new file in index' '
779 Changes to be committed:
780 (use "git reset HEAD <file>..." to unstage)
782 modified: dir1/modified
785 (use "git add <file>..." to include in what will be committed)
793 git commit --dry-run dir1/modified >output &&
794 test_i18ncmp expect output
798 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
800 test_expect_success
'status refreshes the index' '
803 git diff-files >output &&
804 test_cmp expect output
807 test_expect_success
'setup status submodule summary' '
808 test_create_repo sm && (
812 git commit -m "Add foo"
817 test_expect_success
'status submodule summary is disabled by default' '
820 Changes to be committed:
821 (use "git reset HEAD <file>..." to unstage)
826 Changes not staged for commit:
827 (use "git add <file>..." to update what will be committed)
828 (use "git checkout -- <file>..." to discard changes in working directory)
830 modified: dir1/modified
833 (use "git add <file>..." to include in what will be committed)
842 git status >output &&
843 test_i18ncmp expect output
846 # we expect the same as the previous test
847 test_expect_success
'status --untracked-files=all does not show submodule' '
848 git status --untracked-files=all >output &&
849 test_i18ncmp expect output
863 test_expect_success
'status -s submodule summary is disabled by default' '
864 git status -s >output &&
865 test_cmp expect output
868 # we expect the same as the previous test
869 test_expect_success
'status -s --untracked-files=all does not show submodule' '
870 git status -s --untracked-files=all >output &&
871 test_cmp expect output
874 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
876 test_expect_success
'status submodule summary' '
879 Changes to be committed:
880 (use "git reset HEAD <file>..." to unstage)
885 Changes not staged for commit:
886 (use "git add <file>..." to update what will be committed)
887 (use "git checkout -- <file>..." to discard changes in working directory)
889 modified: dir1/modified
891 Submodule changes to be committed:
893 * sm 0000000...$head (1):
897 (use "git add <file>..." to include in what will be committed)
906 git config status.submodulesummary 10 &&
907 git status >output &&
908 test_i18ncmp expect output
911 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
912 strip_comments expect &&
913 git -c status.displayCommentPrefix=false status >output &&
914 test_i18ncmp expect output
917 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
918 commit_template_commented
932 test_expect_success
'status -s submodule summary' '
933 git status -s >output &&
934 test_cmp expect output
937 test_expect_success
'status submodule summary (clean submodule): commit' '
940 Changes not staged for commit:
941 (use "git add <file>..." to update what will be committed)
942 (use "git checkout -- <file>..." to discard changes in working directory)
944 modified: dir1/modified
947 (use "git add <file>..." to include in what will be committed)
955 no changes added to commit (use "git add" and/or "git commit -a")
957 git commit -m "commit submodule" &&
958 git config status.submodulesummary 10 &&
959 test_must_fail git commit --dry-run >output &&
960 test_i18ncmp expect output &&
961 git status >output &&
962 test_i18ncmp expect output
974 test_expect_success
'status -s submodule summary (clean submodule)' '
975 git status -s >output &&
976 test_cmp expect output
979 test_expect_success
'status -z implies porcelain' '
980 git status --porcelain |
981 "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
982 git status -z >output &&
983 test_cmp expect output
986 test_expect_success
'commit --dry-run submodule summary (--amend)' '
989 Changes to be committed:
990 (use "git reset HEAD^1 <file>..." to unstage)
995 Changes not staged for commit:
996 (use "git add <file>..." to update what will be committed)
997 (use "git checkout -- <file>..." to discard changes in working directory)
999 modified: dir1/modified
1001 Submodule changes to be committed:
1003 * sm 0000000...$head (1):
1007 (use "git add <file>..." to include in what will be committed)
1016 git config status.submodulesummary 10 &&
1017 git commit --dry-run --amend >output &&
1018 test_i18ncmp expect output
1021 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1024 # make dir1/tracked stat-dirty
1025 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1026 git status -s >output &&
1027 ! grep dir1/tracked output &&
1028 # make sure "status" succeeded without writing index out
1029 git diff-files | grep dir1/tracked
1036 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1037 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1040 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1041 cat > expect << EOF &&
1043 Changes to be committed:
1044 (use "git reset HEAD <file>..." to unstage)
1048 Changes not staged for commit:
1049 (use "git add <file>..." to update what will be committed)
1050 (use "git checkout -- <file>..." to discard changes in working directory)
1052 modified: dir1/modified
1054 Submodule changes to be committed:
1056 * sm $head...$new_head (1):
1060 (use "git add <file>..." to include in what will be committed)
1070 echo modified sm/untracked &&
1071 git status --ignore-submodules=untracked >output &&
1072 test_i18ncmp expect output
1075 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1076 test_config diff.ignoreSubmodules dirty &&
1077 git status >output &&
1078 test_i18ncmp expect output &&
1079 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1080 git config --add -f .gitmodules submodule.subname.path sm &&
1081 git status >output &&
1082 test_i18ncmp expect output &&
1083 git config -f .gitmodules --remove-section submodule.subname
1086 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1087 git config --add -f .gitmodules submodule.subname.ignore none &&
1088 git config --add -f .gitmodules submodule.subname.path sm &&
1089 git config --add submodule.subname.ignore untracked &&
1090 git config --add submodule.subname.path sm &&
1091 git status >output &&
1092 test_i18ncmp expect output &&
1093 git config --remove-section submodule.subname &&
1094 git config --remove-section -f .gitmodules submodule.subname
1097 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1098 git status --ignore-submodules=dirty >output &&
1099 test_i18ncmp expect output
1102 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1103 test_config diff.ignoreSubmodules dirty &&
1104 git status >output &&
1106 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1107 git config --add -f .gitmodules submodule.subname.path sm &&
1108 git status >output &&
1109 test_i18ncmp expect output &&
1110 git config -f .gitmodules --remove-section submodule.subname
1113 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1114 git config --add -f .gitmodules submodule.subname.ignore none &&
1115 git config --add -f .gitmodules submodule.subname.path sm &&
1116 git config --add submodule.subname.ignore dirty &&
1117 git config --add submodule.subname.path sm &&
1118 git status >output &&
1119 test_i18ncmp expect output &&
1120 git config --remove-section submodule.subname &&
1121 git config -f .gitmodules --remove-section submodule.subname
1124 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1125 echo modified >sm/foo &&
1126 git status --ignore-submodules=dirty >output &&
1127 test_i18ncmp expect output
1130 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1131 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1132 git config --add -f .gitmodules submodule.subname.path sm &&
1133 git status >output &&
1134 test_i18ncmp expect output &&
1135 git config -f .gitmodules --remove-section submodule.subname
1138 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1139 git config --add -f .gitmodules submodule.subname.ignore none &&
1140 git config --add -f .gitmodules submodule.subname.path sm &&
1141 git config --add submodule.subname.ignore dirty &&
1142 git config --add submodule.subname.path sm &&
1143 git status >output &&
1144 test_i18ncmp expect output &&
1145 git config --remove-section submodule.subname &&
1146 git config -f .gitmodules --remove-section submodule.subname
1149 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1150 cat > expect << EOF &&
1152 Changes to be committed:
1153 (use "git reset HEAD <file>..." to unstage)
1157 Changes not staged for commit:
1158 (use "git add <file>..." to update what will be committed)
1159 (use "git checkout -- <file>..." to discard changes in working directory)
1160 (commit or discard the untracked or modified content in submodules)
1162 modified: dir1/modified
1163 modified: sm (modified content)
1165 Submodule changes to be committed:
1167 * sm $head...$new_head (1):
1171 (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)
1242 git status --ignore-submodules=untracked > output &&
1243 test_i18ncmp expect output
1246 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1247 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1248 git config --add -f .gitmodules submodule.subname.path sm &&
1249 git status >output &&
1250 test_i18ncmp expect output &&
1251 git config -f .gitmodules --remove-section submodule.subname
1254 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1255 git config --add -f .gitmodules submodule.subname.ignore none &&
1256 git config --add -f .gitmodules submodule.subname.path sm &&
1257 git config --add submodule.subname.ignore untracked &&
1258 git config --add submodule.subname.path sm &&
1259 git status >output &&
1260 test_i18ncmp expect output &&
1261 git config --remove-section submodule.subname &&
1262 git config -f .gitmodules --remove-section submodule.subname
1265 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1266 git status --ignore-submodules=dirty > output &&
1267 test_i18ncmp expect output
1269 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1270 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1271 git config --add -f .gitmodules submodule.subname.path sm &&
1272 git status >output &&
1273 test_i18ncmp expect output &&
1274 git config -f .gitmodules --remove-section submodule.subname
1277 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1278 git config --add -f .gitmodules submodule.subname.ignore none &&
1279 git config --add -f .gitmodules submodule.subname.path sm &&
1280 git config --add submodule.subname.ignore dirty &&
1281 git config --add submodule.subname.path sm &&
1282 git status >output &&
1283 test_i18ncmp expect output &&
1284 git config --remove-section submodule.subname &&
1285 git config -f .gitmodules --remove-section submodule.subname
1290 ; Changes to be committed:
1291 ; (use "git reset HEAD <file>..." to unstage)
1295 ; Changes not staged for commit:
1296 ; (use "git add <file>..." to update what will be committed)
1297 ; (use "git checkout -- <file>..." to discard changes in working directory)
1299 ; modified: dir1/modified
1300 ; modified: sm (new commits)
1302 ; Submodule changes to be committed:
1304 ; * sm $head...$new_head (1):
1307 ; Submodules changed but not updated:
1309 ; * sm $new_head...$head2 (1):
1313 ; (use "git add <file>..." to include in what will be committed)
1324 test_expect_success
"status (core.commentchar with submodule summary)" '
1325 test_config core.commentchar ";" &&
1326 git -c status.displayCommentPrefix=true status >output &&
1327 test_i18ncmp expect output
1330 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1331 test_config core.commentchar ";;" &&
1332 git -c status.displayCommentPrefix=true status >output &&
1333 test_i18ncmp expect output
1336 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1337 cat > expect << EOF &&
1339 Changes not staged for commit:
1340 (use "git add <file>..." to update what will be committed)
1341 (use "git checkout -- <file>..." to discard changes in working directory)
1343 modified: dir1/modified
1346 (use "git add <file>..." to include in what will be committed)
1355 no changes added to commit (use "git add" and/or "git commit -a")
1357 git status --ignore-submodules=all > output &&
1358 test_i18ncmp expect output
1361 test_expect_failure
'.gitmodules ignore=all suppresses submodule summary' '
1362 git config --add -f .gitmodules submodule.subname.ignore all &&
1363 git config --add -f .gitmodules submodule.subname.path sm &&
1364 git status > output &&
1365 test_cmp expect output &&
1366 git config -f .gitmodules --remove-section submodule.subname
1369 test_expect_failure
'.git/config ignore=all suppresses submodule summary' '
1370 git config --add -f .gitmodules submodule.subname.ignore none &&
1371 git config --add -f .gitmodules submodule.subname.path sm &&
1372 git config --add submodule.subname.ignore all &&
1373 git config --add submodule.subname.path sm &&
1374 git status > output &&
1375 test_cmp expect output &&
1376 git config --remove-section submodule.subname &&
1377 git config -f .gitmodules --remove-section submodule.subname
1380 test_expect_success
'setup of test environment' '
1381 git config status.showUntrackedFiles no &&
1382 git status -s >expected_short &&
1383 git status --no-short >expected_noshort
1386 test_expect_success
'"status.short=true" same as "-s"' '
1387 git -c status.short=true status >actual &&
1388 test_cmp expected_short actual
1391 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1392 git -c status.short=true status --no-short >actual &&
1393 test_cmp expected_noshort actual
1396 test_expect_success
'"status.short=false" same as "--no-short"' '
1397 git -c status.short=false status >actual &&
1398 test_cmp expected_noshort actual
1401 test_expect_success
'"status.short=false" weaker than "-s"' '
1402 git -c status.short=false status -s >actual &&
1403 test_cmp expected_short actual
1406 test_expect_success
'"status.branch=true" same as "-b"' '
1407 git status -sb >expected_branch &&
1408 git -c status.branch=true status -s >actual &&
1409 test_cmp expected_branch actual
1412 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1413 git status -s --no-branch >expected_nobranch &&
1414 git -c status.branch=true status -s >actual &&
1415 test_must_fail test_cmp expected_nobranch actual
1418 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1419 git -c status.branch=true status -s --no-branch >actual &&
1420 test_cmp expected_nobranch actual
1423 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1424 git -c status.branch=true status --porcelain >actual &&
1425 test_cmp expected_nobranch actual
1428 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1429 git -c status.branch=false status -s >actual &&
1430 test_cmp expected_nobranch actual
1433 test_expect_success
'"status.branch=false" weaker than "-b"' '
1434 git -c status.branch=false status -sb >actual &&
1435 test_cmp expected_branch actual
1438 test_expect_success
'Restore default test environment' '
1439 git config --unset status.showUntrackedFiles