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
'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
178 test_expect_success
'status (advice.statusHints false)' '
179 test_config advice.statusHints false &&
180 git status >output &&
181 test_i18ncmp expect output
194 test_expect_success
'status -s' '
196 git status -s >output &&
197 test_cmp expect output
201 test_expect_success
'status with gitignore' '
209 cat >expect <<-\EOF &&
214 git status -s >output &&
215 test_cmp expect output &&
217 cat >expect <<-\EOF &&
228 git status -s --ignored >output &&
229 test_cmp expect output &&
231 cat >expect <<\EOF &&
233 Changes to be committed:
234 (use "git reset HEAD <file>..." to unstage)
238 Changes not staged for commit:
239 (use "git add <file>..." to update what will be committed)
240 (use "git checkout -- <file>..." to discard changes in working directory)
242 modified: dir1/modified
245 (use "git add <file>..." to include in what will be committed)
250 (use "git add -f <file>..." to include in what will be committed)
260 git status --ignored >output &&
261 test_i18ncmp expect output
264 test_expect_success
'status with gitignore (nothing untracked)' '
268 echo "dir2/modified" &&
273 cat >expect <<-\EOF &&
277 git status -s >output &&
278 test_cmp expect output &&
280 cat >expect <<-\EOF &&
291 git status -s --ignored >output &&
292 test_cmp expect output &&
294 cat >expect <<\EOF &&
296 Changes to be committed:
297 (use "git reset HEAD <file>..." to unstage)
301 Changes not staged for commit:
302 (use "git add <file>..." to update what will be committed)
303 (use "git checkout -- <file>..." to discard changes in working directory)
305 modified: dir1/modified
308 (use "git add -f <file>..." to include in what will be committed)
319 git status --ignored >output &&
320 test_i18ncmp expect output
323 cat >.gitignore
<<\EOF
339 test_expect_success
'status -s -b' '
341 git status -s -b >output &&
342 test_cmp expect output
346 test_expect_success
'status -s -z -b' '
347 tr "\\n" Q <expect >expect.q &&
348 mv expect.q expect &&
349 git status -s -z -b >output &&
350 nul_to_q <output >output.q &&
351 mv output.q output &&
352 test_cmp expect output
355 test_expect_success
'setup dir3' '
357 : >dir3/untracked1 &&
361 test_expect_success
'status -uno' '
364 Changes to be committed:
365 (use "git reset HEAD <file>..." to unstage)
369 Changes not staged for commit:
370 (use "git add <file>..." to update what will be committed)
371 (use "git checkout -- <file>..." to discard changes in working directory)
373 modified: dir1/modified
375 Untracked files not listed (use -u option to show untracked files)
377 git status -uno >output &&
378 test_i18ncmp expect output
381 test_expect_success
'status (status.showUntrackedFiles no)' '
382 test_config status.showuntrackedfiles no &&
383 git status >output &&
384 test_i18ncmp expect output
387 test_expect_success
'status -uno (advice.statusHints false)' '
390 Changes to be committed:
393 Changes not staged for commit:
394 modified: dir1/modified
396 Untracked files not listed
398 test_config advice.statusHints false &&
399 git status -uno >output &&
400 test_i18ncmp expect output
407 test_expect_success
'status -s -uno' '
408 git status -s -uno >output &&
409 test_cmp expect output
412 test_expect_success
'status -s (status.showUntrackedFiles no)' '
413 git config status.showuntrackedfiles no
414 git status -s >output &&
415 test_cmp expect output
418 test_expect_success
'status -unormal' '
421 Changes to be committed:
422 (use "git reset HEAD <file>..." to unstage)
426 Changes not staged for commit:
427 (use "git add <file>..." to update what will be committed)
428 (use "git checkout -- <file>..." to discard changes in working directory)
430 modified: dir1/modified
433 (use "git add <file>..." to include in what will be committed)
442 git status -unormal >output &&
443 test_i18ncmp expect output
446 test_expect_success
'status (status.showUntrackedFiles normal)' '
447 test_config status.showuntrackedfiles normal
448 git status >output &&
449 test_i18ncmp expect output
461 test_expect_success
'status -s -unormal' '
462 git status -s -unormal >output &&
463 test_cmp expect output
466 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
467 git config status.showuntrackedfiles normal
468 git status -s >output &&
469 test_cmp expect output
472 test_expect_success
'status -uall' '
475 Changes to be committed:
476 (use "git reset HEAD <file>..." to unstage)
480 Changes not staged for commit:
481 (use "git add <file>..." to update what will be committed)
482 (use "git checkout -- <file>..." to discard changes in working directory)
484 modified: dir1/modified
487 (use "git add <file>..." to include in what will be committed)
497 git status -uall >output &&
498 test_i18ncmp expect output
501 test_expect_success
'status (status.showUntrackedFiles all)' '
502 test_config status.showuntrackedfiles all
503 git status >output &&
504 test_i18ncmp expect output
507 test_expect_success
'teardown dir3' '
519 test_expect_success
'status -s -uall' '
520 git config --unset status.showuntrackedfiles
521 git status -s -uall >output &&
522 test_cmp expect output
524 test_expect_success
'status -s (status.showUntrackedFiles all)' '
525 test_config status.showuntrackedfiles all &&
526 git status -s >output &&
528 test_cmp expect output
531 test_expect_success
'status with relative paths' '
532 cat >expect <<\EOF &&
534 Changes to be committed:
535 (use "git reset HEAD <file>..." to unstage)
537 new file: ../dir2/added
539 Changes not staged for commit:
540 (use "git add <file>..." to update what will be committed)
541 (use "git checkout -- <file>..." to discard changes in working directory)
546 (use "git add <file>..." to include in what will be committed)
554 (cd dir1 && git status) >output &&
555 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
582 test_expect_success
'status --porcelain ignores relative paths setting' '
584 (cd dir1 && git status --porcelain) >output &&
585 test_cmp expect output
589 test_expect_success
'setup unique colors' '
591 git config status.color.untracked blue &&
592 git config status.color.branch green
596 test_expect_success
'status with color.ui' '
597 cat >expect <<\EOF &&
598 On branch <GREEN>master<RESET>
599 Changes to be committed:
600 (use "git reset HEAD <file>..." to unstage)
602 <GREEN>new file: dir2/added<RESET>
604 Changes not staged for commit:
605 (use "git add <file>..." to update what will be committed)
606 (use "git checkout -- <file>..." to discard changes in working directory)
608 <RED>modified: dir1/modified<RESET>
611 (use "git add <file>..." to include in what will be committed)
613 <BLUE>dir1/untracked<RESET>
614 <BLUE>dir2/modified<RESET>
615 <BLUE>dir2/untracked<RESET>
616 <BLUE>untracked<RESET>
619 test_config color.ui always &&
620 git status | test_decode_color >output &&
621 test_i18ncmp expect output
624 test_expect_success
'status with color.status' '
625 test_config color.status always &&
626 git status | test_decode_color >output &&
627 test_i18ncmp expect output
631 <RED
>M
<RESET
> dir
1/modified
632 <GREEN
>A
<RESET
> dir
2/added
633 <BLUE
>??
<RESET
> dir
1/untracked
634 <BLUE
>??
<RESET
> dir
2/modified
635 <BLUE
>??
<RESET
> dir
2/untracked
636 <BLUE
>??
<RESET
> untracked
639 test_expect_success
'status -s with color.ui' '
641 git config color.ui always &&
642 git status -s | test_decode_color >output &&
643 test_cmp expect output
647 test_expect_success
'status -s with color.status' '
649 git config --unset color.ui &&
650 git config color.status always &&
651 git status -s | test_decode_color >output &&
652 test_cmp expect output
657 ## <GREEN>master<RESET>
658 <RED
>M
<RESET
> dir
1/modified
659 <GREEN
>A
<RESET
> dir
2/added
660 <BLUE
>??
<RESET
> dir
1/untracked
661 <BLUE
>??
<RESET
> dir
2/modified
662 <BLUE
>??
<RESET
> dir
2/untracked
663 <BLUE
>??
<RESET
> untracked
666 test_expect_success
'status -s -b with color.status' '
668 git status -s -b | test_decode_color >output &&
669 test_cmp expect output
682 test_expect_success
'status --porcelain ignores color.ui' '
684 git config --unset color.status &&
685 git config color.ui always &&
686 git status --porcelain | test_decode_color >output &&
687 test_cmp expect output
691 test_expect_success
'status --porcelain ignores color.status' '
693 git config --unset color.ui &&
694 git config color.status always &&
695 git status --porcelain | test_decode_color >output &&
696 test_cmp expect output
700 # recover unconditionally from color tests
701 git config
--unset color.status
702 git config
--unset color.ui
704 test_expect_success
'status --porcelain respects -b' '
706 git status --porcelain -b >output &&
712 test_cmp expect output
718 test_expect_success
'status without relative paths' '
719 cat >expect <<\EOF &&
721 Changes to be committed:
722 (use "git reset HEAD <file>..." to unstage)
726 Changes not staged for commit:
727 (use "git add <file>..." to update what will be committed)
728 (use "git checkout -- <file>..." to discard changes in working directory)
730 modified: dir1/modified
733 (use "git add <file>..." to include in what will be committed)
741 test_config status.relativePaths false &&
742 (cd dir1 && git status) >output &&
743 test_i18ncmp expect output
756 test_expect_success
'status -s without relative paths' '
758 test_config status.relativePaths false &&
759 (cd dir1 && git status -s) >output &&
760 test_cmp expect output
764 test_expect_success
'dry-run of partial commit excluding new file in index' '
767 Changes to be committed:
768 (use "git reset HEAD <file>..." to unstage)
770 modified: dir1/modified
773 (use "git add <file>..." to include in what will be committed)
780 git commit --dry-run dir1/modified >output &&
781 test_i18ncmp expect output
785 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
787 test_expect_success
'status refreshes the index' '
790 git diff-files >output &&
791 test_cmp expect output
794 test_expect_success
'setup status submodule summary' '
795 test_create_repo sm && (
799 git commit -m "Add foo"
804 test_expect_success
'status submodule summary is disabled by default' '
807 Changes to be committed:
808 (use "git reset HEAD <file>..." to unstage)
813 Changes not staged for commit:
814 (use "git add <file>..." to update what will be committed)
815 (use "git checkout -- <file>..." to discard changes in working directory)
817 modified: dir1/modified
820 (use "git add <file>..." to include in what will be committed)
828 git status >output &&
829 test_i18ncmp expect output
832 # we expect the same as the previous test
833 test_expect_success
'status --untracked-files=all does not show submodule' '
834 git status --untracked-files=all >output &&
835 test_i18ncmp expect output
847 test_expect_success
'status -s submodule summary is disabled by default' '
848 git status -s >output &&
849 test_cmp expect output
852 # we expect the same as the previous test
853 test_expect_success
'status -s --untracked-files=all does not show submodule' '
854 git status -s --untracked-files=all >output &&
855 test_cmp expect output
858 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
860 test_expect_success
'status submodule summary' '
863 Changes to be committed:
864 (use "git reset HEAD <file>..." to unstage)
869 Changes not staged for commit:
870 (use "git add <file>..." to update what will be committed)
871 (use "git checkout -- <file>..." to discard changes in working directory)
873 modified: dir1/modified
875 Submodule changes to be committed:
877 * sm 0000000...$head (1):
881 (use "git add <file>..." to include in what will be committed)
889 git config status.submodulesummary 10 &&
890 git status >output &&
891 test_i18ncmp expect output
894 test_expect_success
'status submodule summary with status.displayCommentPrefix=false' '
895 strip_comments expect &&
896 git -c status.displayCommentPrefix=false status >output &&
897 test_i18ncmp expect output
900 test_expect_success
'commit with submodule summary ignores status.displayCommentPrefix' '
901 commit_template_commented
913 test_expect_success
'status -s submodule summary' '
914 git status -s >output &&
915 test_cmp expect output
918 test_expect_success
'status submodule summary (clean submodule): commit' '
921 Changes not staged for commit:
922 (use "git add <file>..." to update what will be committed)
923 (use "git checkout -- <file>..." to discard changes in working directory)
925 modified: dir1/modified
928 (use "git add <file>..." to include in what will be committed)
935 no changes added to commit (use "git add" and/or "git commit -a")
937 git commit -m "commit submodule" &&
938 git config status.submodulesummary 10 &&
939 test_must_fail git commit --dry-run >output &&
940 test_i18ncmp expect output &&
941 git status >output &&
942 test_i18ncmp expect output
952 test_expect_success
'status -s submodule summary (clean submodule)' '
953 git status -s >output &&
954 test_cmp expect output
957 test_expect_success
'status -z implies porcelain' '
958 git status --porcelain |
959 perl -pe "s/\012/\000/g" >expect &&
960 git status -z >output &&
961 test_cmp expect output
964 test_expect_success
'commit --dry-run submodule summary (--amend)' '
967 Changes to be committed:
968 (use "git reset HEAD^1 <file>..." to unstage)
973 Changes not staged for commit:
974 (use "git add <file>..." to update what will be committed)
975 (use "git checkout -- <file>..." to discard changes in working directory)
977 modified: dir1/modified
979 Submodule changes to be committed:
981 * sm 0000000...$head (1):
985 (use "git add <file>..." to include in what will be committed)
993 git config status.submodulesummary 10 &&
994 git commit --dry-run --amend >output &&
995 test_i18ncmp expect output
998 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
1001 # make dir1/tracked stat-dirty
1002 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
1003 git status -s >output &&
1004 ! grep dir1/tracked output &&
1005 # make sure "status" succeeded without writing index out
1006 git diff-files | grep dir1/tracked
1013 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
1014 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
1017 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1018 cat > expect << EOF &&
1020 Changes to be committed:
1021 (use "git reset HEAD <file>..." to unstage)
1025 Changes not staged for commit:
1026 (use "git add <file>..." to update what will be committed)
1027 (use "git checkout -- <file>..." to discard changes in working directory)
1029 modified: dir1/modified
1031 Submodule changes to be committed:
1033 * sm $head...$new_head (1):
1037 (use "git add <file>..." to include in what will be committed)
1046 echo modified sm/untracked &&
1047 git status --ignore-submodules=untracked >output &&
1048 test_i18ncmp expect output
1051 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1052 test_config diff.ignoreSubmodules dirty &&
1053 git status >output &&
1054 test_i18ncmp expect output &&
1055 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1056 git config --add -f .gitmodules submodule.subname.path sm &&
1057 git status >output &&
1058 test_i18ncmp expect output &&
1059 git config -f .gitmodules --remove-section submodule.subname
1062 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1063 git config --add -f .gitmodules submodule.subname.ignore none &&
1064 git config --add -f .gitmodules submodule.subname.path sm &&
1065 git config --add submodule.subname.ignore untracked &&
1066 git config --add submodule.subname.path sm &&
1067 git status >output &&
1068 test_i18ncmp expect output &&
1069 git config --remove-section submodule.subname &&
1070 git config --remove-section -f .gitmodules submodule.subname
1073 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1074 git status --ignore-submodules=dirty >output &&
1075 test_i18ncmp expect output
1078 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1079 test_config diff.ignoreSubmodules dirty &&
1080 git status >output &&
1082 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1083 git config --add -f .gitmodules submodule.subname.path sm &&
1084 git status >output &&
1085 test_i18ncmp expect output &&
1086 git config -f .gitmodules --remove-section submodule.subname
1089 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1090 git config --add -f .gitmodules submodule.subname.ignore none &&
1091 git config --add -f .gitmodules submodule.subname.path sm &&
1092 git config --add submodule.subname.ignore dirty &&
1093 git config --add submodule.subname.path sm &&
1094 git status >output &&
1095 test_i18ncmp expect output &&
1096 git config --remove-section submodule.subname &&
1097 git config -f .gitmodules --remove-section submodule.subname
1100 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1101 echo modified >sm/foo &&
1102 git status --ignore-submodules=dirty >output &&
1103 test_i18ncmp expect output
1106 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1107 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1108 git config --add -f .gitmodules submodule.subname.path sm &&
1109 git status >output &&
1110 test_i18ncmp expect output &&
1111 git config -f .gitmodules --remove-section submodule.subname
1114 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1115 git config --add -f .gitmodules submodule.subname.ignore none &&
1116 git config --add -f .gitmodules submodule.subname.path sm &&
1117 git config --add submodule.subname.ignore dirty &&
1118 git config --add submodule.subname.path sm &&
1119 git status >output &&
1120 test_i18ncmp expect output &&
1121 git config --remove-section submodule.subname &&
1122 git config -f .gitmodules --remove-section submodule.subname
1125 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1126 cat > expect << EOF &&
1128 Changes to be committed:
1129 (use "git reset HEAD <file>..." to unstage)
1133 Changes not staged for commit:
1134 (use "git add <file>..." to update what will be committed)
1135 (use "git checkout -- <file>..." to discard changes in working directory)
1136 (commit or discard the untracked or modified content in submodules)
1138 modified: dir1/modified
1139 modified: sm (modified content)
1141 Submodule changes to be committed:
1143 * sm $head...$new_head (1):
1147 (use "git add <file>..." to include in what will be committed)
1156 git status --ignore-submodules=untracked > output &&
1157 test_i18ncmp expect output
1160 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1161 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1162 git config --add -f .gitmodules submodule.subname.path sm &&
1163 git status >output &&
1164 test_i18ncmp expect output &&
1165 git config -f .gitmodules --remove-section submodule.subname
1168 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1169 git config --add -f .gitmodules submodule.subname.ignore none &&
1170 git config --add -f .gitmodules submodule.subname.path sm &&
1171 git config --add submodule.subname.ignore untracked &&
1172 git config --add submodule.subname.path sm &&
1173 git status >output &&
1174 test_i18ncmp expect output &&
1175 git config --remove-section submodule.subname &&
1176 git config -f .gitmodules --remove-section submodule.subname
1179 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1181 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1182 cat > expect << EOF &&
1184 Changes to be committed:
1185 (use "git reset HEAD <file>..." to unstage)
1189 Changes not staged for commit:
1190 (use "git add <file>..." to update what will be committed)
1191 (use "git checkout -- <file>..." to discard changes in working directory)
1193 modified: dir1/modified
1194 modified: sm (new commits)
1196 Submodule changes to be committed:
1198 * sm $head...$new_head (1):
1201 Submodules changed but not updated:
1203 * sm $new_head...$head2 (1):
1207 (use "git add <file>..." to include in what will be committed)
1216 git status --ignore-submodules=untracked > output &&
1217 test_i18ncmp expect output
1220 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1221 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1222 git config --add -f .gitmodules submodule.subname.path sm &&
1223 git status >output &&
1224 test_i18ncmp expect output &&
1225 git config -f .gitmodules --remove-section submodule.subname
1228 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1229 git config --add -f .gitmodules submodule.subname.ignore none &&
1230 git config --add -f .gitmodules submodule.subname.path sm &&
1231 git config --add submodule.subname.ignore untracked &&
1232 git config --add submodule.subname.path sm &&
1233 git status >output &&
1234 test_i18ncmp expect output &&
1235 git config --remove-section submodule.subname &&
1236 git config -f .gitmodules --remove-section submodule.subname
1239 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1240 git status --ignore-submodules=dirty > output &&
1241 test_i18ncmp expect output
1243 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1244 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1245 git config --add -f .gitmodules submodule.subname.path sm &&
1246 git status >output &&
1247 test_i18ncmp expect output &&
1248 git config -f .gitmodules --remove-section submodule.subname
1251 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1252 git config --add -f .gitmodules submodule.subname.ignore none &&
1253 git config --add -f .gitmodules submodule.subname.path sm &&
1254 git config --add submodule.subname.ignore dirty &&
1255 git config --add submodule.subname.path sm &&
1256 git status >output &&
1257 test_i18ncmp expect output &&
1258 git config --remove-section submodule.subname &&
1259 git config -f .gitmodules --remove-section submodule.subname
1264 ; Changes to be committed:
1265 ; (use "git reset HEAD <file>..." to unstage)
1269 ; Changes not staged for commit:
1270 ; (use "git add <file>..." to update what will be committed)
1271 ; (use "git checkout -- <file>..." to discard changes in working directory)
1273 ; modified: dir1/modified
1274 ; modified: sm (new commits)
1276 ; Submodule changes to be committed:
1278 ; * sm $head...$new_head (1):
1281 ; Submodules changed but not updated:
1283 ; * sm $new_head...$head2 (1):
1287 ; (use "git add <file>..." to include in what will be committed)
1297 test_expect_success
"status (core.commentchar with submodule summary)" '
1298 test_config core.commentchar ";" &&
1299 git -c status.displayCommentPrefix=true status >output &&
1300 test_i18ncmp expect output
1303 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1304 test_config core.commentchar ";;" &&
1305 test_must_fail git -c status.displayCommentPrefix=true status
1308 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1309 cat > expect << EOF &&
1311 Changes not staged for commit:
1312 (use "git add <file>..." to update what will be committed)
1313 (use "git checkout -- <file>..." to discard changes in working directory)
1315 modified: dir1/modified
1318 (use "git add <file>..." to include in what will be committed)
1326 no changes added to commit (use "git add" and/or "git commit -a")
1328 git status --ignore-submodules=all > output &&
1329 test_i18ncmp expect output
1332 test_expect_success
'.gitmodules ignore=all suppresses unstaged submodule summary' '
1333 cat > expect << EOF &&
1335 Changes to be committed:
1336 (use "git reset HEAD <file>..." to unstage)
1340 Changes not staged for commit:
1341 (use "git add <file>..." to update what will be committed)
1342 (use "git checkout -- <file>..." to discard changes in working directory)
1344 modified: dir1/modified
1347 (use "git add <file>..." to include in what will be committed)
1356 git config --add -f .gitmodules submodule.subname.ignore all &&
1357 git config --add -f .gitmodules submodule.subname.path sm &&
1358 git status > output &&
1359 test_cmp expect output &&
1360 git config -f .gitmodules --remove-section submodule.subname
1363 test_expect_success
'.git/config ignore=all suppresses unstaged submodule summary' '
1364 git config --add -f .gitmodules submodule.subname.ignore none &&
1365 git config --add -f .gitmodules submodule.subname.path sm &&
1366 git config --add submodule.subname.ignore all &&
1367 git config --add submodule.subname.path sm &&
1368 git status > output &&
1369 test_cmp expect output &&
1370 git config --remove-section submodule.subname &&
1371 git config -f .gitmodules --remove-section submodule.subname
1374 test_expect_success
'setup of test environment' '
1375 git config status.showUntrackedFiles no &&
1376 git status -s >expected_short &&
1377 git status --no-short >expected_noshort
1380 test_expect_success
'"status.short=true" same as "-s"' '
1381 git -c status.short=true status >actual &&
1382 test_cmp expected_short actual
1385 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1386 git -c status.short=true status --no-short >actual &&
1387 test_cmp expected_noshort actual
1390 test_expect_success
'"status.short=false" same as "--no-short"' '
1391 git -c status.short=false status >actual &&
1392 test_cmp expected_noshort actual
1395 test_expect_success
'"status.short=false" weaker than "-s"' '
1396 git -c status.short=false status -s >actual &&
1397 test_cmp expected_short actual
1400 test_expect_success
'"status.branch=true" same as "-b"' '
1401 git status -sb >expected_branch &&
1402 git -c status.branch=true status -s >actual &&
1403 test_cmp expected_branch actual
1406 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1407 git status -s --no-branch >expected_nobranch &&
1408 git -c status.branch=true status -s >actual &&
1409 test_must_fail test_cmp expected_nobranch actual
1412 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1413 git -c status.branch=true status -s --no-branch >actual &&
1414 test_cmp expected_nobranch actual
1417 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1418 git -c status.branch=true status --porcelain >actual &&
1419 test_cmp expected_nobranch actual
1422 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1423 git -c status.branch=false status -s >actual &&
1424 test_cmp expected_nobranch actual
1427 test_expect_success
'"status.branch=false" weaker than "-b"' '
1428 git -c status.branch=false status -sb >actual &&
1429 test_cmp expected_branch actual
1432 test_expect_success
'Restore default test environment' '
1433 git config --unset status.showUntrackedFiles
1436 test_expect_success
'git commit will commit a staged but ignored submodule' '
1437 git config --add -f .gitmodules submodule.subname.ignore all &&
1438 git config --add -f .gitmodules submodule.subname.path sm &&
1439 git config --add submodule.subname.ignore all &&
1440 git status -s --ignore-submodules=dirty >output &&
1441 test_i18ngrep "^M. sm" output &&
1442 GIT_EDITOR="echo hello >>\"\$1\"" &&
1443 export GIT_EDITOR &&
1445 git status -s --ignore-submodules=dirty >output &&
1446 test_i18ngrep ! "^M. sm" output
1449 test_expect_success
'git commit --dry-run will show a staged but ignored submodule' '
1452 cat >expect << EOF &&
1454 Changes to be committed:
1455 (use "git reset HEAD <file>..." to unstage)
1459 Changes not staged for commit:
1460 (use "git add <file>..." to update what will be committed)
1461 (use "git checkout -- <file>..." to discard changes in working directory)
1463 modified: dir1/modified
1465 Untracked files not listed (use -u option to show untracked files)
1467 git commit -uno --dry-run >output &&
1468 test_i18ncmp expect output &&
1469 git status -s --ignore-submodules=dirty >output &&
1470 test_i18ngrep "^M. sm" output
1473 test_expect_success
'git commit -m will commit a staged but ignored submodule' '
1474 git commit -uno -m message &&
1475 git status -s --ignore-submodules=dirty >output &&
1476 test_i18ngrep ! "^M. sm" output &&
1477 git config --remove-section submodule.subname &&
1478 git config -f .gitmodules --remove-section submodule.subname