3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='git status'
10 test_expect_success
'status -h in broken repository' '
11 git config --global advice.statusuoption false &&
13 test_when_finished "rm -fr broken" &&
17 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
18 test_expect_code 129 git status -h >usage 2>&1
20 test_i18ngrep "[Uu]sage" broken/usage
23 test_expect_success
'commit -h in broken repository' '
25 test_when_finished "rm -fr broken" &&
29 echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
30 test_expect_code 129 git commit -h >usage 2>&1
32 test_i18ngrep "[Uu]sage" broken/usage
35 test_expect_success
'setup' '
49 git commit -m initial &&
53 echo 1 >dir1/modified &&
54 echo 2 >dir2/modified &&
59 test_expect_success
'status (1)' '
60 test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
65 sed "s/^\# //; s/^\#$//; s/^#$tab/$tab/" <"$1" >"$1".tmp
&&
66 rm "$1" && mv "$1".tmp
"$1"
69 cat >.gitignore
<<\EOF
75 test_expect_success
'status --column' '
78 # Changes to be committed:
79 # (use "git reset HEAD <file>..." to unstage)
81 # new file: dir2/added
83 # Changes not staged for commit:
84 # (use "git add <file>..." to update what will be committed)
85 # (use "git checkout -- <file>..." to discard changes in working directory)
87 # modified: dir1/modified
90 # (use "git add <file>..." to include in what will be committed)
92 # dir1/untracked dir2/untracked
93 # dir2/modified untracked
96 COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
97 test_i18ncmp expect output
100 test_expect_success
'status --column status.displayCommentPrefix=false' '
101 strip_comments expect &&
102 COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output &&
103 test_i18ncmp expect output
108 # Changes to be committed:
109 # (use "git reset HEAD <file>..." to unstage)
111 # new file: dir2/added
113 # Changes not staged for commit:
114 # (use "git add <file>..." to update what will be committed)
115 # (use "git checkout -- <file>..." to discard changes in working directory)
117 # modified: dir1/modified
120 # (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
'status -v' '
141 (cat expect && git diff --cached) >expect-with-v &&
142 git status -v >output &&
143 test_i18ncmp expect-with-v output
146 test_expect_success
'status -v -v' '
148 echo "Changes to be committed:" &&
149 git -c diff.mnemonicprefix=true diff --cached &&
150 echo "--------------------------------------------------" &&
151 echo "Changes not staged for commit:" &&
152 git -c diff.mnemonicprefix=true diff) >expect-with-v &&
153 git status -v -v >output &&
154 test_i18ncmp expect-with-v output
157 test_expect_success
'setup fake editor' '
158 cat >.git/editor <<-\EOF &&
162 chmod 755 .git/editor
165 commit_template_commented
() {
167 EDITOR
=.git
/editor
&&
169 # Fails due to empty message
170 test_must_fail git commit
172 ! grep '^[^#]' output
175 test_expect_success
'commit ignores status.displayCommentPrefix=false in COMMIT_EDITMSG' '
176 commit_template_commented
181 Changes to be committed
:
184 Changes not staged
for commit
:
185 modified
: dir
1/modified
195 test_expect_success
'status (advice.statusHints false)' '
196 test_config advice.statusHints false &&
197 git status >output &&
198 test_i18ncmp expect output
211 test_expect_success
'status -s' '
213 git status -s >output &&
214 test_cmp expect output
218 test_expect_success
'status with gitignore' '
226 cat >expect <<-\EOF &&
231 git status -s >output &&
232 test_cmp expect output &&
234 cat >expect <<-\EOF &&
246 git status -s --ignored >output &&
247 test_cmp expect output &&
249 cat >expect <<\EOF &&
251 Changes to be committed:
252 (use "git reset HEAD <file>..." to unstage)
256 Changes not staged for commit:
257 (use "git add <file>..." to update what will be committed)
258 (use "git checkout -- <file>..." to discard changes in working directory)
260 modified: dir1/modified
263 (use "git add <file>..." to include in what will be committed)
268 (use "git add -f <file>..." to include in what will be committed)
279 git status --ignored >output &&
280 test_i18ncmp expect output
283 test_expect_success
'status with gitignore (nothing untracked)' '
287 echo "dir2/modified" &&
292 cat >expect <<-\EOF &&
296 git status -s >output &&
297 test_cmp expect output &&
299 cat >expect <<-\EOF &&
311 git status -s --ignored >output &&
312 test_cmp expect output &&
314 cat >expect <<\EOF &&
316 Changes to be committed:
317 (use "git reset HEAD <file>..." to unstage)
321 Changes not staged for commit:
322 (use "git add <file>..." to update what will be committed)
323 (use "git checkout -- <file>..." to discard changes in working directory)
325 modified: dir1/modified
328 (use "git add -f <file>..." to include in what will be committed)
340 git status --ignored >output &&
341 test_i18ncmp expect output
344 cat >.gitignore
<<\EOF
360 test_expect_success
'status -s -b' '
362 git status -s -b >output &&
363 test_cmp expect output
367 test_expect_success
'status -s -z -b' '
368 tr "\\n" Q <expect >expect.q &&
369 mv expect.q expect &&
370 git status -s -z -b >output &&
371 nul_to_q <output >output.q &&
372 mv output.q output &&
373 test_cmp expect output
376 test_expect_success
'setup dir3' '
378 : >dir3/untracked1 &&
382 test_expect_success
'status -uno' '
385 Changes to be committed:
386 (use "git reset HEAD <file>..." to unstage)
390 Changes not staged for commit:
391 (use "git add <file>..." to update what will be committed)
392 (use "git checkout -- <file>..." to discard changes in working directory)
394 modified: dir1/modified
396 Untracked files not listed (use -u option to show untracked files)
398 git status -uno >output &&
399 test_i18ncmp expect output
402 test_expect_success
'status (status.showUntrackedFiles no)' '
403 test_config status.showuntrackedfiles no &&
404 git status >output &&
405 test_i18ncmp expect output
408 test_expect_success
'status -uno (advice.statusHints false)' '
411 Changes to be committed:
414 Changes not staged for commit:
415 modified: dir1/modified
417 Untracked files not listed
419 test_config advice.statusHints false &&
420 git status -uno >output &&
421 test_i18ncmp expect output
428 test_expect_success
'status -s -uno' '
429 git status -s -uno >output &&
430 test_cmp expect output
433 test_expect_success
'status -s (status.showUntrackedFiles no)' '
434 git config status.showuntrackedfiles no &&
435 git status -s >output &&
436 test_cmp expect output
439 test_expect_success
'status -unormal' '
442 Changes to be committed:
443 (use "git reset HEAD <file>..." to unstage)
447 Changes not staged for commit:
448 (use "git add <file>..." to update what will be committed)
449 (use "git checkout -- <file>..." to discard changes in working directory)
451 modified: dir1/modified
454 (use "git add <file>..." to include in what will be committed)
463 git status -unormal >output &&
464 test_i18ncmp expect output
467 test_expect_success
'status (status.showUntrackedFiles normal)' '
468 test_config status.showuntrackedfiles normal &&
469 git status >output &&
470 test_i18ncmp expect output
482 test_expect_success
'status -s -unormal' '
483 git status -s -unormal >output &&
484 test_cmp expect output
487 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
488 git config status.showuntrackedfiles normal &&
489 git status -s >output &&
490 test_cmp expect output
493 test_expect_success
'status -uall' '
496 Changes to be committed:
497 (use "git reset HEAD <file>..." to unstage)
501 Changes not staged for commit:
502 (use "git add <file>..." to update what will be committed)
503 (use "git checkout -- <file>..." to discard changes in working directory)
505 modified: dir1/modified
508 (use "git add <file>..." to include in what will be committed)
518 git status -uall >output &&
519 test_i18ncmp expect output
522 test_expect_success
'status (status.showUntrackedFiles all)' '
523 test_config status.showuntrackedfiles all &&
524 git status >output &&
525 test_i18ncmp expect output
528 test_expect_success
'teardown dir3' '
540 test_expect_success
'status -s -uall' '
541 test_unconfig status.showuntrackedfiles &&
542 git status -s -uall >output &&
543 test_cmp expect output
545 test_expect_success
'status -s (status.showUntrackedFiles all)' '
546 test_config status.showuntrackedfiles all &&
547 git status -s >output &&
549 test_cmp expect output
552 test_expect_success
'status with relative paths' '
553 cat >expect <<\EOF &&
555 Changes to be committed:
556 (use "git reset HEAD <file>..." to unstage)
558 new file: ../dir2/added
560 Changes not staged for commit:
561 (use "git add <file>..." to update what will be committed)
562 (use "git checkout -- <file>..." to discard changes in working directory)
567 (use "git add <file>..." to include in what will be committed)
575 (cd dir1 && git status) >output &&
576 test_i18ncmp expect output
587 test_expect_success
'status -s with relative paths' '
589 (cd dir1 && git status -s) >output &&
590 test_cmp expect output
603 test_expect_success
'status --porcelain ignores relative paths setting' '
605 (cd dir1 && git status --porcelain) >output &&
606 test_cmp expect output
610 test_expect_success
'setup unique colors' '
612 git config status.color.untracked blue &&
613 git config status.color.branch green
617 test_expect_success
'status with color.ui' '
618 cat >expect <<\EOF &&
619 On branch <GREEN>master<RESET>
620 Changes to be committed:
621 (use "git reset HEAD <file>..." to unstage)
623 <GREEN>new file: dir2/added<RESET>
625 Changes not staged for commit:
626 (use "git add <file>..." to update what will be committed)
627 (use "git checkout -- <file>..." to discard changes in working directory)
629 <RED>modified: dir1/modified<RESET>
632 (use "git add <file>..." to include in what will be committed)
634 <BLUE>dir1/untracked<RESET>
635 <BLUE>dir2/modified<RESET>
636 <BLUE>dir2/untracked<RESET>
637 <BLUE>untracked<RESET>
640 test_config color.ui always &&
641 git status | test_decode_color >output &&
642 test_i18ncmp expect output
645 test_expect_success
'status with color.status' '
646 test_config color.status always &&
647 git status | test_decode_color >output &&
648 test_i18ncmp expect output
652 <RED
>M
<RESET
> dir
1/modified
653 <GREEN
>A
<RESET
> dir
2/added
654 <BLUE
>??
<RESET
> dir
1/untracked
655 <BLUE
>??
<RESET
> dir
2/modified
656 <BLUE
>??
<RESET
> dir
2/untracked
657 <BLUE
>??
<RESET
> untracked
660 test_expect_success
'status -s with color.ui' '
662 git config color.ui always &&
663 git status -s | test_decode_color >output &&
664 test_cmp expect output
668 test_expect_success
'status -s with color.status' '
670 git config --unset color.ui &&
671 git config color.status always &&
672 git status -s | test_decode_color >output &&
673 test_cmp expect output
678 ## <GREEN>master<RESET>
679 <RED
>M
<RESET
> dir
1/modified
680 <GREEN
>A
<RESET
> dir
2/added
681 <BLUE
>??
<RESET
> dir
1/untracked
682 <BLUE
>??
<RESET
> dir
2/modified
683 <BLUE
>??
<RESET
> dir
2/untracked
684 <BLUE
>??
<RESET
> untracked
687 test_expect_success
'status -s -b with color.status' '
689 git status -s -b | test_decode_color >output &&
690 test_cmp expect output
703 test_expect_success
'status --porcelain ignores color.ui' '
705 git config --unset color.status &&
706 git config color.ui always &&
707 git status --porcelain | test_decode_color >output &&
708 test_cmp expect output
712 test_expect_success
'status --porcelain ignores color.status' '
714 git config --unset color.ui &&
715 git config color.status always &&
716 git status --porcelain | test_decode_color >output &&
717 test_cmp expect output
721 # recover unconditionally from color tests
722 git config
--unset color.status
723 git config
--unset color.ui
725 test_expect_success
'status --porcelain respects -b' '
727 git status --porcelain -b >output &&
733 test_cmp expect output
739 test_expect_success
'status without relative paths' '
740 cat >expect <<\EOF &&
742 Changes to be committed:
743 (use "git reset HEAD <file>..." to unstage)
747 Changes not staged for commit:
748 (use "git add <file>..." to update what will be committed)
749 (use "git checkout -- <file>..." to discard changes in working directory)
751 modified: dir1/modified
754 (use "git add <file>..." to include in what will be committed)
762 test_config status.relativePaths false &&
763 (cd dir1 && git status) >output &&
764 test_i18ncmp expect output
777 test_expect_success
'status -s without relative paths' '
779 test_config status.relativePaths false &&
780 (cd dir1 && git status -s) >output &&
781 test_cmp expect output
785 test_expect_success
'dry-run of partial commit excluding new file in index' '
788 Changes to be committed:
789 (use "git reset HEAD <file>..." to unstage)
791 modified: dir1/modified
794 (use "git add <file>..." to include in what will be committed)
801 git commit --dry-run dir1/modified >output &&
802 test_i18ncmp expect output
806 :100644 100644 $EMPTY_BLOB 0000000000000000000000000000000000000000 M dir1/modified
808 test_expect_success
'status refreshes the index' '
811 git diff-files >output &&
812 test_cmp expect output
815 test_expect_success
'setup status submodule summary' '
816 test_create_repo sm && (
820 git commit -m "Add foo"
825 test_expect_success
'status submodule summary is disabled by default' '
828 Changes to be committed:
829 (use "git reset HEAD <file>..." to unstage)
834 Changes not staged for commit:
835 (use "git add <file>..." to update what will be committed)
836 (use "git checkout -- <file>..." to discard changes in working directory)
838 modified: dir1/modified
841 (use "git add <file>..." to include in what will be committed)
849 git status >output &&
850 test_i18ncmp expect output
853 # we expect the same as the previous test
854 test_expect_success
'status --untracked-files=all does not show submodule' '
855 git status --untracked-files=all >output &&
856 test_i18ncmp expect output
868 test_expect_success
'status -s submodule summary is disabled by default' '
869 git status -s >output &&
870 test_cmp expect output
873 # we expect the same as the previous test
874 test_expect_success
'status -s --untracked-files=all does not show submodule' '
875 git status -s --untracked-files=all >output &&
876 test_cmp expect output
879 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
881 test_expect_success
'status submodule summary' '
884 Changes to be committed:
885 (use "git reset HEAD <file>..." to unstage)
890 Changes not staged for commit:
891 (use "git add <file>..." to update what will be committed)
892 (use "git checkout -- <file>..." to discard changes in working directory)
894 modified: dir1/modified
896 Submodule changes to be committed:
898 * sm 0000000...$head (1):
902 (use "git add <file>..." to include in what will be committed)
910 git config status.submodulesummary 10 &&
911 git status >output &&
912 test_i18ncmp expect output
915 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
916 strip_comments expect &&
917 git -c status.displayCommentPrefix=false status >output &&
918 test_i18ncmp expect output
921 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
922 commit_template_commented
934 test_expect_success
'status -s submodule summary' '
935 git status -s >output &&
936 test_cmp expect output
939 test_expect_success
'status submodule summary (clean submodule): commit' '
942 Changes not staged for commit:
943 (use "git add <file>..." to update what will be committed)
944 (use "git checkout -- <file>..." to discard changes in working directory)
946 modified: dir1/modified
949 (use "git add <file>..." to include in what will be committed)
956 no changes added to commit (use "git add" and/or "git commit -a")
958 git commit -m "commit submodule" &&
959 git config status.submodulesummary 10 &&
960 test_must_fail git commit --dry-run >output &&
961 test_i18ncmp expect output &&
962 git status >output &&
963 test_i18ncmp expect output
973 test_expect_success
'status -s submodule summary (clean submodule)' '
974 git status -s >output &&
975 test_cmp expect output
978 test_expect_success
'status -z implies porcelain' '
979 git status --porcelain |
980 perl -pe "s/\012/\000/g" >expect &&
981 git status -z >output &&
982 test_cmp expect output
985 test_expect_success
'commit --dry-run submodule summary (--amend)' '
988 Changes to be committed:
989 (use "git reset HEAD^1 <file>..." to unstage)
994 Changes not staged for commit:
995 (use "git add <file>..." to update what will be committed)
996 (use "git checkout -- <file>..." to discard changes in working directory)
998 modified: dir1/modified
1000 Submodule changes to be committed:
1002 * sm 0000000...$head (1):
1006 (use "git add <file>..." to include in what will be committed)
1014 git config status.submodulesummary 10 &&
1015 git commit --dry-run --amend >output &&
1016 test_i18ncmp expect output
1019 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1022 # make dir1/tracked stat-dirty
1023 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1024 git status -s >output &&
1025 ! grep dir1/tracked output &&
1026 # make sure "status" succeeded without writing index out
1027 git diff-files | grep dir1/tracked
1034 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1035 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1038 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1039 cat > expect << EOF &&
1041 Changes to be committed:
1042 (use "git reset HEAD <file>..." to unstage)
1046 Changes not staged for commit:
1047 (use "git add <file>..." to update what will be committed)
1048 (use "git checkout -- <file>..." to discard changes in working directory)
1050 modified: dir1/modified
1052 Submodule changes to be committed:
1054 * sm $head...$new_head (1):
1058 (use "git add <file>..." to include in what will be committed)
1067 echo modified sm/untracked &&
1068 git status --ignore-submodules=untracked >output &&
1069 test_i18ncmp expect output
1072 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1073 test_config diff.ignoreSubmodules dirty &&
1074 git status >output &&
1075 test_i18ncmp expect output &&
1076 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1077 git config --add -f .gitmodules submodule.subname.path sm &&
1078 git status >output &&
1079 test_i18ncmp expect output &&
1080 git config -f .gitmodules --remove-section submodule.subname
1083 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1084 git config --add -f .gitmodules submodule.subname.ignore none &&
1085 git config --add -f .gitmodules submodule.subname.path sm &&
1086 git config --add submodule.subname.ignore untracked &&
1087 git config --add submodule.subname.path sm &&
1088 git status >output &&
1089 test_i18ncmp expect output &&
1090 git config --remove-section submodule.subname &&
1091 git config --remove-section -f .gitmodules submodule.subname
1094 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1095 git status --ignore-submodules=dirty >output &&
1096 test_i18ncmp expect output
1099 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1100 test_config diff.ignoreSubmodules dirty &&
1101 git status >output &&
1103 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1104 git config --add -f .gitmodules submodule.subname.path sm &&
1105 git status >output &&
1106 test_i18ncmp expect output &&
1107 git config -f .gitmodules --remove-section submodule.subname
1110 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1111 git config --add -f .gitmodules submodule.subname.ignore none &&
1112 git config --add -f .gitmodules submodule.subname.path sm &&
1113 git config --add submodule.subname.ignore dirty &&
1114 git config --add submodule.subname.path sm &&
1115 git status >output &&
1116 test_i18ncmp expect output &&
1117 git config --remove-section submodule.subname &&
1118 git config -f .gitmodules --remove-section submodule.subname
1121 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1122 echo modified >sm/foo &&
1123 git status --ignore-submodules=dirty >output &&
1124 test_i18ncmp expect output
1127 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
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 modified 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=untracked doesn't suppress submodules with modified content" '
1147 cat > expect << EOF &&
1149 Changes to be committed:
1150 (use "git reset HEAD <file>..." to unstage)
1154 Changes not staged for commit:
1155 (use "git add <file>..." to update what will be committed)
1156 (use "git checkout -- <file>..." to discard changes in working directory)
1157 (commit or discard the untracked or modified content in submodules)
1159 modified: dir1/modified
1160 modified: sm (modified content)
1162 Submodule changes to be committed:
1164 * sm $head...$new_head (1):
1168 (use "git add <file>..." to include in what will be committed)
1177 git status --ignore-submodules=untracked > output &&
1178 test_i18ncmp expect output
1181 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1182 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1183 git config --add -f .gitmodules submodule.subname.path sm &&
1184 git status >output &&
1185 test_i18ncmp expect output &&
1186 git config -f .gitmodules --remove-section submodule.subname
1189 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1190 git config --add -f .gitmodules submodule.subname.ignore none &&
1191 git config --add -f .gitmodules submodule.subname.path sm &&
1192 git config --add submodule.subname.ignore untracked &&
1193 git config --add submodule.subname.path sm &&
1194 git status >output &&
1195 test_i18ncmp expect output &&
1196 git config --remove-section submodule.subname &&
1197 git config -f .gitmodules --remove-section submodule.subname
1200 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1202 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1203 cat > expect << EOF &&
1205 Changes to be committed:
1206 (use "git reset HEAD <file>..." to unstage)
1210 Changes not staged for commit:
1211 (use "git add <file>..." to update what will be committed)
1212 (use "git checkout -- <file>..." to discard changes in working directory)
1214 modified: dir1/modified
1215 modified: sm (new commits)
1217 Submodule changes to be committed:
1219 * sm $head...$new_head (1):
1222 Submodules changed but not updated:
1224 * sm $new_head...$head2 (1):
1228 (use "git add <file>..." to include in what will be committed)
1237 git status --ignore-submodules=untracked > output &&
1238 test_i18ncmp expect output
1241 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1242 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1243 git config --add -f .gitmodules submodule.subname.path sm &&
1244 git status >output &&
1245 test_i18ncmp expect output &&
1246 git config -f .gitmodules --remove-section submodule.subname
1249 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1250 git config --add -f .gitmodules submodule.subname.ignore none &&
1251 git config --add -f .gitmodules submodule.subname.path sm &&
1252 git config --add submodule.subname.ignore untracked &&
1253 git config --add submodule.subname.path sm &&
1254 git status >output &&
1255 test_i18ncmp expect output &&
1256 git config --remove-section submodule.subname &&
1257 git config -f .gitmodules --remove-section submodule.subname
1260 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1261 git status --ignore-submodules=dirty > output &&
1262 test_i18ncmp expect output
1264 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1265 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1266 git config --add -f .gitmodules submodule.subname.path sm &&
1267 git status >output &&
1268 test_i18ncmp expect output &&
1269 git config -f .gitmodules --remove-section submodule.subname
1272 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1273 git config --add -f .gitmodules submodule.subname.ignore none &&
1274 git config --add -f .gitmodules submodule.subname.path sm &&
1275 git config --add submodule.subname.ignore dirty &&
1276 git config --add submodule.subname.path sm &&
1277 git status >output &&
1278 test_i18ncmp expect output &&
1279 git config --remove-section submodule.subname &&
1280 git config -f .gitmodules --remove-section submodule.subname
1285 ; Changes to be committed:
1286 ; (use "git reset HEAD <file>..." to unstage)
1290 ; Changes not staged for commit:
1291 ; (use "git add <file>..." to update what will be committed)
1292 ; (use "git checkout -- <file>..." to discard changes in working directory)
1294 ; modified: dir1/modified
1295 ; modified: sm (new commits)
1297 ; Submodule changes to be committed:
1299 ; * sm $head...$new_head (1):
1302 ; Submodules changed but not updated:
1304 ; * sm $new_head...$head2 (1):
1308 ; (use "git add <file>..." to include in what will be committed)
1318 test_expect_success
"status (core.commentchar with submodule summary)" '
1319 test_config core.commentchar ";" &&
1320 git -c status.displayCommentPrefix=true status >output &&
1321 test_i18ncmp expect output
1324 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1325 test_config core.commentchar ";;" &&
1326 test_must_fail git -c status.displayCommentPrefix=true status
1329 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1330 cat > expect << EOF &&
1332 Changes not staged for commit:
1333 (use "git add <file>..." to update what will be committed)
1334 (use "git checkout -- <file>..." to discard changes in working directory)
1336 modified: dir1/modified
1339 (use "git add <file>..." to include in what will be committed)
1347 no changes added to commit (use "git add" and/or "git commit -a")
1349 git status --ignore-submodules=all > output &&
1350 test_i18ncmp expect output
1353 test_expect_success
'.gitmodules ignore=all suppresses unstaged submodule summary' '
1354 cat > expect << EOF &&
1356 Changes to be committed:
1357 (use "git reset HEAD <file>..." to unstage)
1361 Changes not staged for commit:
1362 (use "git add <file>..." to update what will be committed)
1363 (use "git checkout -- <file>..." to discard changes in working directory)
1365 modified: dir1/modified
1368 (use "git add <file>..." to include in what will be committed)
1377 git config --add -f .gitmodules submodule.subname.ignore all &&
1378 git config --add -f .gitmodules submodule.subname.path sm &&
1379 git status > output &&
1380 test_i18ncmp expect output &&
1381 git config -f .gitmodules --remove-section submodule.subname
1384 test_expect_success
'.git/config ignore=all suppresses unstaged submodule summary' '
1385 git config --add -f .gitmodules submodule.subname.ignore none &&
1386 git config --add -f .gitmodules submodule.subname.path sm &&
1387 git config --add submodule.subname.ignore all &&
1388 git config --add submodule.subname.path sm &&
1389 git status > output &&
1390 test_i18ncmp expect output &&
1391 git config --remove-section submodule.subname &&
1392 git config -f .gitmodules --remove-section submodule.subname
1395 test_expect_success
'setup of test environment' '
1396 git config status.showUntrackedFiles no &&
1397 git status -s >expected_short &&
1398 git status --no-short >expected_noshort
1401 test_expect_success
'"status.short=true" same as "-s"' '
1402 git -c status.short=true status >actual &&
1403 test_cmp expected_short actual
1406 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1407 git -c status.short=true status --no-short >actual &&
1408 test_cmp expected_noshort actual
1411 test_expect_success
'"status.short=false" same as "--no-short"' '
1412 git -c status.short=false status >actual &&
1413 test_cmp expected_noshort actual
1416 test_expect_success
'"status.short=false" weaker than "-s"' '
1417 git -c status.short=false status -s >actual &&
1418 test_cmp expected_short actual
1421 test_expect_success
'"status.branch=true" same as "-b"' '
1422 git status -sb >expected_branch &&
1423 git -c status.branch=true status -s >actual &&
1424 test_cmp expected_branch actual
1427 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1428 git status -s --no-branch >expected_nobranch &&
1429 git -c status.branch=true status -s >actual &&
1430 test_must_fail test_cmp expected_nobranch actual
1433 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1434 git -c status.branch=true status -s --no-branch >actual &&
1435 test_cmp expected_nobranch actual
1438 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1439 git -c status.branch=true status --porcelain >actual &&
1440 test_cmp expected_nobranch actual
1443 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1444 git -c status.branch=false status -s >actual &&
1445 test_cmp expected_nobranch actual
1448 test_expect_success
'"status.branch=false" weaker than "-b"' '
1449 git -c status.branch=false status -sb >actual &&
1450 test_cmp expected_branch actual
1453 test_expect_success
'Restore default test environment' '
1454 git config --unset status.showUntrackedFiles
1457 test_expect_success
'git commit will commit a staged but ignored submodule' '
1458 git config --add -f .gitmodules submodule.subname.ignore all &&
1459 git config --add -f .gitmodules submodule.subname.path sm &&
1460 git config --add submodule.subname.ignore all &&
1461 git status -s --ignore-submodules=dirty >output &&
1462 test_i18ngrep "^M. sm" output &&
1463 GIT_EDITOR="echo hello >>\"\$1\"" &&
1464 export GIT_EDITOR &&
1466 git status -s --ignore-submodules=dirty >output &&
1467 test_i18ngrep ! "^M. sm" output
1470 test_expect_success
'git commit --dry-run will show a staged but ignored submodule' '
1473 cat >expect << EOF &&
1475 Changes to be committed:
1476 (use "git reset HEAD <file>..." to unstage)
1480 Changes not staged for commit:
1481 (use "git add <file>..." to update what will be committed)
1482 (use "git checkout -- <file>..." to discard changes in working directory)
1484 modified: dir1/modified
1486 Untracked files not listed (use -u option to show untracked files)
1488 git commit -uno --dry-run >output &&
1489 test_i18ncmp expect output &&
1490 git status -s --ignore-submodules=dirty >output &&
1491 test_i18ngrep "^M. sm" output
1494 test_expect_success
'git commit -m will commit a staged but ignored submodule' '
1495 git commit -uno -m message &&
1496 git status -s --ignore-submodules=dirty >output &&
1497 test_i18ngrep ! "^M. sm" output &&
1498 git config --remove-section submodule.subname &&
1499 git config -f .gitmodules --remove-section submodule.subname