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
63 test_expect_success
'status --column' '
64 COLUMNS=50 git status --column="column dense" >output &&
67 # Changes to be committed:
68 # (use "git reset HEAD <file>..." to unstage)
70 # new file: dir2/added
72 # Changes not staged for commit:
73 # (use "git add <file>..." to update what will be committed)
74 # (use "git checkout -- <file>..." to discard changes in working directory)
76 # modified: dir1/modified
79 # (use "git add <file>..." to include in what will be committed)
81 # dir1/untracked dir2/untracked untracked
82 # dir2/modified output
84 test_i18ncmp expect output
89 # Changes to be committed:
90 # (use "git reset HEAD <file>..." to unstage)
92 # new file: dir2/added
94 # Changes not staged for commit:
95 # (use "git add <file>..." to update what will be committed)
96 # (use "git checkout -- <file>..." to discard changes in working directory)
98 # modified: dir1/modified
101 # (use "git add <file>..." to include in what will be committed)
111 test_expect_success
'status (2)' '
112 git status >output &&
113 test_i18ncmp expect output
118 # Changes to be committed:
119 # new file: dir2/added
121 # Changes not staged for commit:
122 # modified: dir1/modified
133 test_expect_success
'status (advice.statusHints false)' '
134 test_config advice.statusHints false &&
135 git status >output &&
136 test_i18ncmp expect output
151 test_expect_success
'status -s' '
153 git status -s >output &&
154 test_cmp expect output
158 test_expect_success
'status with gitignore' '
166 cat >expect <<-\EOF &&
171 git status -s >output &&
172 test_cmp expect output &&
174 cat >expect <<-\EOF &&
185 git status -s --ignored >output &&
186 test_cmp expect output &&
188 cat >expect <<-\EOF &&
190 # Changes to be committed:
191 # (use "git reset HEAD <file>..." to unstage)
193 # new file: dir2/added
195 # Changes not staged for commit:
196 # (use "git add <file>..." to update what will be committed)
197 # (use "git checkout -- <file>..." to discard changes in working directory)
199 # modified: dir1/modified
202 # (use "git add <file>..." to include in what will be committed)
206 # (use "git add -f <file>..." to include in what will be committed)
215 git status --ignored >output &&
216 test_i18ncmp expect output
219 test_expect_success
'status with gitignore (nothing untracked)' '
223 echo "dir2/modified" &&
228 cat >expect <<-\EOF &&
232 git status -s >output &&
233 test_cmp expect output &&
235 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)
254 # new file: dir2/added
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 -f <file>..." to include in what will be committed)
273 git status --ignored >output &&
274 test_i18ncmp expect output
291 test_expect_success
'status -s -b' '
293 git status -s -b >output &&
294 test_cmp expect output
298 test_expect_success
'status -s -z -b' '
299 tr "\\n" Q <expect >expect.q &&
300 mv expect.q expect &&
301 git status -s -z -b >output &&
302 nul_to_q <output >output.q &&
303 mv output.q output &&
304 test_cmp expect output
307 test_expect_success
'setup dir3' '
309 : >dir3/untracked1 &&
315 # Changes to be committed:
316 # (use "git reset HEAD <file>..." to unstage)
318 # new file: dir2/added
320 # Changes not staged for commit:
321 # (use "git add <file>..." to update what will be committed)
322 # (use "git checkout -- <file>..." to discard changes in working directory)
324 # modified: dir1/modified
326 # Untracked files not listed (use -u option to show untracked files)
328 test_expect_success
'status -uno' '
329 git status -uno >output &&
330 test_i18ncmp expect output
333 test_expect_success
'status (status.showUntrackedFiles no)' '
334 test_config status.showuntrackedfiles no &&
335 git status >output &&
336 test_i18ncmp expect output
341 # Changes to be committed:
342 # new file: dir2/added
344 # Changes not staged for commit:
345 # modified: dir1/modified
347 # Untracked files not listed
349 test_expect_success
'status -uno (advice.statusHints false)' '
350 test_config advice.statusHints false &&
351 git status -uno >output &&
352 test_i18ncmp expect output
359 test_expect_success
'status -s -uno' '
360 git status -s -uno >output &&
361 test_cmp expect output
364 test_expect_success
'status -s (status.showUntrackedFiles no)' '
365 git config status.showuntrackedfiles no
366 git status -s >output &&
367 test_cmp expect output
372 # Changes to be committed:
373 # (use "git reset HEAD <file>..." to unstage)
375 # new file: dir2/added
377 # Changes not staged for commit:
378 # (use "git add <file>..." to update what will be committed)
379 # (use "git checkout -- <file>..." to discard changes in working directory)
381 # modified: dir1/modified
384 # (use "git add <file>..." to include in what will be committed)
394 test_expect_success
'status -unormal' '
395 git status -unormal >output &&
396 test_i18ncmp expect output
399 test_expect_success
'status (status.showUntrackedFiles normal)' '
400 test_config status.showuntrackedfiles normal
401 git status >output &&
402 test_i18ncmp expect output
416 test_expect_success
'status -s -unormal' '
417 git status -s -unormal >output &&
418 test_cmp expect output
421 test_expect_success
'status -s (status.showUntrackedFiles normal)' '
422 git config status.showuntrackedfiles normal
423 git status -s >output &&
424 test_cmp expect output
429 # Changes to be committed:
430 # (use "git reset HEAD <file>..." to unstage)
432 # new file: dir2/added
434 # Changes not staged for commit:
435 # (use "git add <file>..." to update what will be committed)
436 # (use "git checkout -- <file>..." to discard changes in working directory)
438 # modified: dir1/modified
441 # (use "git add <file>..." to include in what will be committed)
452 test_expect_success
'status -uall' '
453 git status -uall >output &&
454 test_i18ncmp expect output
457 test_expect_success
'status (status.showUntrackedFiles all)' '
458 test_config status.showuntrackedfiles all
459 git status >output &&
460 test_i18ncmp expect output
463 test_expect_success
'teardown dir3' '
477 test_expect_success
'status -s -uall' '
478 git config --unset status.showuntrackedfiles
479 git status -s -uall >output &&
480 test_cmp expect output
482 test_expect_success
'status -s (status.showUntrackedFiles all)' '
483 test_config status.showuntrackedfiles all &&
484 git status -s >output &&
486 test_cmp expect output
491 # Changes to be committed:
492 # (use "git reset HEAD <file>..." to unstage)
494 # new file: ../dir2/added
496 # Changes not staged for commit:
497 # (use "git add <file>..." to update what will be committed)
498 # (use "git checkout -- <file>..." to discard changes in working directory)
503 # (use "git add <file>..." to include in what will be committed)
513 test_expect_success
'status with relative paths' '
514 (cd dir1 && git status) >output &&
515 test_i18ncmp expect output
528 test_expect_success
'status -s with relative paths' '
530 (cd dir1 && git status -s) >output &&
531 test_cmp expect output
546 test_expect_success
'status --porcelain ignores relative paths setting' '
548 (cd dir1 && git status --porcelain) >output &&
549 test_cmp expect output
553 test_expect_success
'setup unique colors' '
555 git config status.color.untracked blue &&
556 git config status.color.branch green
561 # On branch <GREEN>master<RESET>
562 # Changes to be committed:
563 # (use "git reset HEAD <file>..." to unstage)
565 # <GREEN>new file: dir2/added<RESET>
567 # Changes not staged for commit:
568 # (use "git add <file>..." to update what will be committed)
569 # (use "git checkout -- <file>..." to discard changes in working directory)
571 # <RED>modified: dir1/modified<RESET>
574 # (use "git add <file>..." to include in what will be committed)
576 # <BLUE>dir1/untracked<RESET>
577 # <BLUE>dir2/modified<RESET>
578 # <BLUE>dir2/untracked<RESET>
579 # <BLUE>expect<RESET>
580 # <BLUE>output<RESET>
581 # <BLUE>untracked<RESET>
584 test_expect_success
'status with color.ui' '
585 test_config color.ui always &&
586 git status | test_decode_color >output &&
587 test_i18ncmp expect output
590 test_expect_success
'status with color.status' '
591 test_config color.status always &&
592 git status | test_decode_color >output &&
593 test_i18ncmp expect output
597 <RED
>M
<RESET
> dir
1/modified
598 <GREEN
>A
<RESET
> dir
2/added
599 <BLUE
>??
<RESET
> dir
1/untracked
600 <BLUE
>??
<RESET
> dir
2/modified
601 <BLUE
>??
<RESET
> dir
2/untracked
602 <BLUE
>??
<RESET
> expect
603 <BLUE
>??
<RESET
> output
604 <BLUE
>??
<RESET
> untracked
607 test_expect_success
'status -s with color.ui' '
609 git config color.ui always &&
610 git status -s | test_decode_color >output &&
611 test_cmp expect output
615 test_expect_success
'status -s with color.status' '
617 git config --unset color.ui &&
618 git config color.status always &&
619 git status -s | test_decode_color >output &&
620 test_cmp expect output
625 ## <GREEN>master<RESET>
626 <RED
>M
<RESET
> dir
1/modified
627 <GREEN
>A
<RESET
> dir
2/added
628 <BLUE
>??
<RESET
> dir
1/untracked
629 <BLUE
>??
<RESET
> dir
2/modified
630 <BLUE
>??
<RESET
> dir
2/untracked
631 <BLUE
>??
<RESET
> expect
632 <BLUE
>??
<RESET
> output
633 <BLUE
>??
<RESET
> untracked
636 test_expect_success
'status -s -b with color.status' '
638 git status -s -b | test_decode_color >output &&
639 test_cmp expect output
654 test_expect_success
'status --porcelain ignores color.ui' '
656 git config --unset color.status &&
657 git config color.ui always &&
658 git status --porcelain | test_decode_color >output &&
659 test_cmp expect output
663 test_expect_success
'status --porcelain ignores color.status' '
665 git config --unset color.ui &&
666 git config color.status always &&
667 git status --porcelain | test_decode_color >output &&
668 test_cmp expect output
672 # recover unconditionally from color tests
673 git config
--unset color.status
674 git config
--unset color.ui
676 test_expect_success
'status --porcelain respects -b' '
678 git status --porcelain -b >output &&
684 test_cmp expect output
690 # Changes to be committed:
691 # (use "git reset HEAD <file>..." to unstage)
693 # new file: dir2/added
695 # Changes not staged for commit:
696 # (use "git add <file>..." to update what will be committed)
697 # (use "git checkout -- <file>..." to discard changes in working directory)
699 # modified: dir1/modified
702 # (use "git add <file>..." to include in what will be committed)
713 test_expect_success
'status without relative paths' '
715 test_config status.relativePaths false &&
716 (cd dir1 && git status) >output &&
717 test_i18ncmp expect output
732 test_expect_success
'status -s without relative paths' '
734 test_config status.relativePaths false &&
735 (cd dir1 && git status -s) >output &&
736 test_cmp expect output
742 # Changes to be committed:
743 # (use "git reset HEAD <file>..." to unstage)
745 # modified: dir1/modified
748 # (use "git add <file>..." to include in what will be committed)
756 test_expect_success
'dry-run of partial commit excluding new file in index' '
757 git commit --dry-run dir1/modified >output &&
758 test_i18ncmp expect output
762 :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M dir1/modified
764 test_expect_success
'status refreshes the index' '
767 git diff-files >output &&
768 test_cmp expect output
771 test_expect_success
'setup status submodule summary' '
772 test_create_repo sm && (
776 git commit -m "Add foo"
783 # Changes to be committed:
784 # (use "git reset HEAD <file>..." to unstage)
786 # new file: dir2/added
789 # Changes not staged for commit:
790 # (use "git add <file>..." to update what will be committed)
791 # (use "git checkout -- <file>..." to discard changes in working directory)
793 # modified: dir1/modified
796 # (use "git add <file>..." to include in what will be committed)
805 test_expect_success
'status submodule summary is disabled by default' '
806 git status >output &&
807 test_i18ncmp expect output
810 # we expect the same as the previous test
811 test_expect_success
'status --untracked-files=all does not show submodule' '
812 git status --untracked-files=all >output &&
813 test_i18ncmp expect output
827 test_expect_success
'status -s submodule summary is disabled by default' '
828 git status -s >output &&
829 test_cmp expect output
832 # we expect the same as the previous test
833 test_expect_success
'status -s --untracked-files=all does not show submodule' '
834 git status -s --untracked-files=all >output &&
835 test_cmp expect output
838 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
842 # Changes to be committed:
843 # (use "git reset HEAD <file>..." to unstage)
845 # new file: dir2/added
848 # Changes not staged for commit:
849 # (use "git add <file>..." to update what will be committed)
850 # (use "git checkout -- <file>..." to discard changes in working directory)
852 # modified: dir1/modified
854 # Submodule changes to be committed:
856 # * sm 0000000...$head (1):
860 # (use "git add <file>..." to include in what will be committed)
869 test_expect_success
'status submodule summary' '
870 git config status.submodulesummary 10 &&
871 git status >output &&
872 test_i18ncmp expect output
886 test_expect_success
'status -s submodule summary' '
887 git status -s >output &&
888 test_cmp expect output
893 # Changes not staged for commit:
894 # (use "git add <file>..." to update what will be committed)
895 # (use "git checkout -- <file>..." to discard changes in working directory)
897 # modified: dir1/modified
900 # (use "git add <file>..." to include in what will be committed)
908 no changes added to commit (use "git add" and/or "git commit -a")
910 test_expect_success
'status submodule summary (clean submodule): commit' '
911 git commit -m "commit submodule" &&
912 git config status.submodulesummary 10 &&
913 test_must_fail git commit --dry-run >output &&
914 test_i18ncmp expect output &&
915 git status >output &&
916 test_i18ncmp expect output
928 test_expect_success
'status -s submodule summary (clean submodule)' '
929 git status -s >output &&
930 test_cmp expect output
933 test_expect_success
'status -z implies porcelain' '
934 git status --porcelain |
935 "$PERL_PATH" -pe "s/\012/\000/g" >expect &&
936 git status -z >output &&
937 test_cmp expect output
942 # Changes to be committed:
943 # (use "git reset HEAD^1 <file>..." to unstage)
945 # new file: dir2/added
948 # Changes not staged for commit:
949 # (use "git add <file>..." to update what will be committed)
950 # (use "git checkout -- <file>..." to discard changes in working directory)
952 # modified: dir1/modified
954 # Submodule changes to be committed:
956 # * sm 0000000...$head (1):
960 # (use "git add <file>..." to include in what will be committed)
969 test_expect_success
'commit --dry-run submodule summary (--amend)' '
970 git config status.submodulesummary 10 &&
971 git commit --dry-run --amend >output &&
972 test_i18ncmp expect output
975 test_expect_success POSIXPERM
,SANITY
'status succeeds in a read-only repository' '
978 # make dir1/tracked stat-dirty
979 >dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
980 git status -s >output &&
981 ! grep dir1/tracked output &&
982 # make sure "status" succeeded without writing index out
983 git diff-files | grep dir1/tracked
990 (cd sm
&& echo > bar
&& git add bar
&& git commit
-q -m 'Add bar') && git add sm
991 new_head
=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
996 # Changes to be committed:
997 # (use "git reset HEAD <file>..." to unstage)
1001 # Changes not staged for commit:
1002 # (use "git add <file>..." to update what will be committed)
1003 # (use "git checkout -- <file>..." to discard changes in working directory)
1005 # modified: dir1/modified
1007 # Submodule changes to be committed:
1009 # * sm $head...$new_head (1):
1013 # (use "git add <file>..." to include in what will be committed)
1024 test_expect_success
'--ignore-submodules=untracked suppresses submodules with untracked content' '
1025 echo modified sm/untracked &&
1026 git status --ignore-submodules=untracked >output &&
1027 test_i18ncmp expect output
1030 test_expect_success
'.gitmodules ignore=untracked suppresses submodules with untracked content' '
1031 test_config diff.ignoreSubmodules dirty &&
1032 git status >output &&
1033 test_i18ncmp expect output &&
1034 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1035 git config --add -f .gitmodules submodule.subname.path sm &&
1036 git status >output &&
1037 test_i18ncmp expect output &&
1038 git config -f .gitmodules --remove-section submodule.subname
1041 test_expect_success
'.git/config ignore=untracked suppresses submodules with untracked content' '
1042 git config --add -f .gitmodules submodule.subname.ignore none &&
1043 git config --add -f .gitmodules submodule.subname.path sm &&
1044 git config --add submodule.subname.ignore untracked &&
1045 git config --add submodule.subname.path sm &&
1046 git status >output &&
1047 test_i18ncmp expect output &&
1048 git config --remove-section submodule.subname &&
1049 git config --remove-section -f .gitmodules submodule.subname
1052 test_expect_success
'--ignore-submodules=dirty suppresses submodules with untracked content' '
1053 git status --ignore-submodules=dirty >output &&
1054 test_i18ncmp expect output
1057 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with untracked content' '
1058 test_config diff.ignoreSubmodules dirty &&
1059 git status >output &&
1061 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1062 git config --add -f .gitmodules submodule.subname.path sm &&
1063 git status >output &&
1064 test_i18ncmp expect output &&
1065 git config -f .gitmodules --remove-section submodule.subname
1068 test_expect_success
'.git/config ignore=dirty suppresses submodules with untracked content' '
1069 git config --add -f .gitmodules submodule.subname.ignore none &&
1070 git config --add -f .gitmodules submodule.subname.path sm &&
1071 git config --add submodule.subname.ignore dirty &&
1072 git config --add submodule.subname.path sm &&
1073 git status >output &&
1074 test_i18ncmp expect output &&
1075 git config --remove-section submodule.subname &&
1076 git config -f .gitmodules --remove-section submodule.subname
1079 test_expect_success
'--ignore-submodules=dirty suppresses submodules with modified content' '
1080 echo modified >sm/foo &&
1081 git status --ignore-submodules=dirty >output &&
1082 test_i18ncmp expect output
1085 test_expect_success
'.gitmodules ignore=dirty suppresses submodules with modified content' '
1086 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1087 git config --add -f .gitmodules submodule.subname.path sm &&
1088 git status >output &&
1089 test_i18ncmp expect output &&
1090 git config -f .gitmodules --remove-section submodule.subname
1093 test_expect_success
'.git/config ignore=dirty suppresses submodules with modified content' '
1094 git config --add -f .gitmodules submodule.subname.ignore none &&
1095 git config --add -f .gitmodules submodule.subname.path sm &&
1096 git config --add submodule.subname.ignore dirty &&
1097 git config --add submodule.subname.path sm &&
1098 git status >output &&
1099 test_i18ncmp expect output &&
1100 git config --remove-section submodule.subname &&
1101 git config -f .gitmodules --remove-section submodule.subname
1106 # Changes to be committed:
1107 # (use "git reset HEAD <file>..." to unstage)
1111 # Changes not staged for commit:
1112 # (use "git add <file>..." to update what will be committed)
1113 # (use "git checkout -- <file>..." to discard changes in working directory)
1114 # (commit or discard the untracked or modified content in submodules)
1116 # modified: dir1/modified
1117 # modified: sm (modified content)
1119 # Submodule changes to be committed:
1121 # * sm $head...$new_head (1):
1125 # (use "git add <file>..." to include in what will be committed)
1136 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodules with modified content" '
1137 git status --ignore-submodules=untracked > output &&
1138 test_i18ncmp expect output
1141 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
1142 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1143 git config --add -f .gitmodules submodule.subname.path sm &&
1144 git status >output &&
1145 test_i18ncmp expect output &&
1146 git config -f .gitmodules --remove-section submodule.subname
1149 test_expect_success
".git/config ignore=untracked doesn't suppress submodules with modified content" '
1150 git config --add -f .gitmodules submodule.subname.ignore none &&
1151 git config --add -f .gitmodules submodule.subname.path sm &&
1152 git config --add submodule.subname.ignore untracked &&
1153 git config --add submodule.subname.path sm &&
1154 git status >output &&
1155 test_i18ncmp expect output &&
1156 git config --remove-section submodule.subname &&
1157 git config -f .gitmodules --remove-section submodule.subname
1160 head2
=$
(cd sm
&& git commit
-q -m "2nd commit" foo
&& git rev-parse
--short=7 --verify HEAD
)
1164 # Changes to be committed:
1165 # (use "git reset HEAD <file>..." to unstage)
1169 # Changes not staged for commit:
1170 # (use "git add <file>..." to update what will be committed)
1171 # (use "git checkout -- <file>..." to discard changes in working directory)
1173 # modified: dir1/modified
1174 # modified: sm (new commits)
1176 # Submodule changes to be committed:
1178 # * sm $head...$new_head (1):
1181 # Submodules changed but not updated:
1183 # * sm $new_head...$head2 (1):
1187 # (use "git add <file>..." to include in what will be committed)
1198 test_expect_success
"--ignore-submodules=untracked doesn't suppress submodule summary" '
1199 git status --ignore-submodules=untracked > output &&
1200 test_i18ncmp expect output
1203 test_expect_success
".gitmodules ignore=untracked doesn't suppress submodule summary" '
1204 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1205 git config --add -f .gitmodules submodule.subname.path sm &&
1206 git status >output &&
1207 test_i18ncmp expect output &&
1208 git config -f .gitmodules --remove-section submodule.subname
1211 test_expect_success
".git/config ignore=untracked doesn't suppress submodule summary" '
1212 git config --add -f .gitmodules submodule.subname.ignore none &&
1213 git config --add -f .gitmodules submodule.subname.path sm &&
1214 git config --add submodule.subname.ignore untracked &&
1215 git config --add submodule.subname.path sm &&
1216 git status >output &&
1217 test_i18ncmp expect output &&
1218 git config --remove-section submodule.subname &&
1219 git config -f .gitmodules --remove-section submodule.subname
1222 test_expect_success
"--ignore-submodules=dirty doesn't suppress submodule summary" '
1223 git status --ignore-submodules=dirty > output &&
1224 test_i18ncmp expect output
1226 test_expect_success
".gitmodules ignore=dirty doesn't suppress submodule summary" '
1227 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1228 git config --add -f .gitmodules submodule.subname.path sm &&
1229 git status >output &&
1230 test_i18ncmp expect output &&
1231 git config -f .gitmodules --remove-section submodule.subname
1234 test_expect_success
".git/config ignore=dirty doesn't suppress submodule summary" '
1235 git config --add -f .gitmodules submodule.subname.ignore none &&
1236 git config --add -f .gitmodules submodule.subname.path sm &&
1237 git config --add submodule.subname.ignore dirty &&
1238 git config --add submodule.subname.path sm &&
1239 git status >output &&
1240 test_i18ncmp expect output &&
1241 git config --remove-section submodule.subname &&
1242 git config -f .gitmodules --remove-section submodule.subname
1247 ; Changes to be committed:
1248 ; (use "git reset HEAD <file>..." to unstage)
1252 ; Changes not staged for commit:
1253 ; (use "git add <file>..." to update what will be committed)
1254 ; (use "git checkout -- <file>..." to discard changes in working directory)
1256 ; modified: dir1/modified
1257 ; modified: sm (new commits)
1259 ; Submodule changes to be committed:
1261 ; * sm $head...$new_head (1):
1264 ; Submodules changed but not updated:
1266 ; * sm $new_head...$head2 (1):
1270 ; (use "git add <file>..." to include in what will be committed)
1281 test_expect_success
"status (core.commentchar with submodule summary)" '
1282 test_config core.commentchar ";" &&
1283 git status >output &&
1284 test_i18ncmp expect output
1287 test_expect_success
"status (core.commentchar with two chars with submodule summary)" '
1288 test_config core.commentchar ";;" &&
1289 git status >output &&
1290 test_i18ncmp expect output
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
1302 # (use "git add <file>..." to include in what will be committed)
1311 no changes added to commit (use "git add" and/or "git commit -a")
1314 test_expect_success
"--ignore-submodules=all suppresses submodule summary" '
1315 git status --ignore-submodules=all > output &&
1316 test_i18ncmp expect output
1319 test_expect_failure
'.gitmodules ignore=all suppresses submodule summary' '
1320 git config --add -f .gitmodules submodule.subname.ignore all &&
1321 git config --add -f .gitmodules submodule.subname.path sm &&
1322 git status > output &&
1323 test_cmp expect output &&
1324 git config -f .gitmodules --remove-section submodule.subname
1327 test_expect_failure
'.git/config ignore=all suppresses submodule summary' '
1328 git config --add -f .gitmodules submodule.subname.ignore none &&
1329 git config --add -f .gitmodules submodule.subname.path sm &&
1330 git config --add submodule.subname.ignore all &&
1331 git config --add submodule.subname.path sm &&
1332 git status > output &&
1333 test_cmp expect output &&
1334 git config --remove-section submodule.subname &&
1335 git config -f .gitmodules --remove-section submodule.subname
1338 test_expect_success
'setup of test environment' '
1339 git config status.showUntrackedFiles no &&
1340 git status -s >expected_short &&
1341 git status --no-short >expected_noshort
1344 test_expect_success
'"status.short=true" same as "-s"' '
1345 git -c status.short=true status >actual &&
1346 test_cmp expected_short actual
1349 test_expect_success
'"status.short=true" weaker than "--no-short"' '
1350 git -c status.short=true status --no-short >actual &&
1351 test_cmp expected_noshort actual
1354 test_expect_success
'"status.short=false" same as "--no-short"' '
1355 git -c status.short=false status >actual &&
1356 test_cmp expected_noshort actual
1359 test_expect_success
'"status.short=false" weaker than "-s"' '
1360 git -c status.short=false status -s >actual &&
1361 test_cmp expected_short actual
1364 test_expect_success
'"status.branch=true" same as "-b"' '
1365 git status -sb >expected_branch &&
1366 git -c status.branch=true status -s >actual &&
1367 test_cmp expected_branch actual
1370 test_expect_success
'"status.branch=true" different from "--no-branch"' '
1371 git status -s --no-branch >expected_nobranch &&
1372 git -c status.branch=true status -s >actual &&
1373 test_must_fail test_cmp expected_nobranch actual
1376 test_expect_success
'"status.branch=true" weaker than "--no-branch"' '
1377 git -c status.branch=true status -s --no-branch >actual &&
1378 test_cmp expected_nobranch actual
1381 test_expect_success
'"status.branch=true" weaker than "--porcelain"' '
1382 git -c status.branch=true status --porcelain >actual &&
1383 test_cmp expected_nobranch actual
1386 test_expect_success
'"status.branch=false" same as "--no-branch"' '
1387 git -c status.branch=false status -s >actual &&
1388 test_cmp expected_nobranch actual
1391 test_expect_success
'"status.branch=false" weaker than "-b"' '
1392 git -c status.branch=false status -sb >actual &&
1393 test_cmp expected_branch actual
1396 test_expect_success
'Restore default test environment' '
1397 git config --unset status.showUntrackedFiles