status: remove the empty line after hints

Before this patch, there is inconsistency between the status messages with hints and the ones without hints: there is an empty line between the title and the file list if hints are presented, but there isn't one if there are no hints. This patch remove the inconsistency by removing the empty lines even if hints are presented. Signed-off-by: John Lin <johnlinp@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Lin committed Jun 4, 2019 at 07:02 UTC b2f5171ecc2feb4192acd80f5a6b05c06e099e97
4 files changed -85
t/t7060-wtstatus.sh
-5
@@ -38,7 +38,6 @@ You have unmerged paths.
38
39 Unmerged paths:
40 (use "git add/rm <file>..." as appropriate to mark resolution)
41 -
41 deleted by us: foo
42
43 no changes added to commit (use "git add" and/or "git commit -a")
@@ -143,7 +142,6 @@ You have unmerged paths.
142
143 Unmerged paths:
144 (use "git add/rm <file>..." as appropriate to mark resolution)
146 -
145 both added: conflict.txt
146 deleted by them: main.txt
147
@@ -177,7 +175,6 @@ You have unmerged paths.
175
176 Unmerged paths:
177 (use "git add/rm <file>..." as appropriate to mark resolution)
180 -
178 both deleted: main.txt
179 added by them: sub_master.txt
180 added by us: sub_second.txt
@@ -201,12 +198,10 @@ You have unmerged paths.
198 (use "git merge --abort" to abort the merge)
199
200 Changes to be committed:
204 -
201 new file: sub_master.txt
202
203 Unmerged paths:
204 (use "git rm <file>..." to mark resolution)
209 -
205 both deleted: main.txt
206
207 Untracked files not listed (use -u option to show untracked files)
t/t7508-status.sh
-62
@@ -95,18 +95,15 @@ test_expect_success 'status --column' '
95 #
96 # Changes to be committed:
97 # (use "git restore --staged <file>..." to unstage)
98 -#
98 # new file: dir2/added
99 #
100 # Changes not staged for commit:
101 # (use "git add <file>..." to update what will be committed)
102 # (use "git restore <file>..." to discard changes in working directory)
104 -#
103 # modified: dir1/modified
104 #
105 # Untracked files:
106 # (use "git add <file>..." to include in what will be committed)
109 -#
107 # dir1/untracked dir2/untracked
108 # dir2/modified untracked
109 #
@@ -129,18 +126,15 @@ cat >expect <<\EOF
126 #
127 # Changes to be committed:
128 # (use "git restore --staged <file>..." to unstage)
132 -#
129 # new file: dir2/added
130 #
131 # Changes not staged for commit:
132 # (use "git add <file>..." to update what will be committed)
133 # (use "git restore <file>..." to discard changes in working directory)
138 -#
134 # modified: dir1/modified
135 #
136 # Untracked files:
137 # (use "git add <file>..." to include in what will be committed)
143 -#
138 # dir1/untracked
139 # dir2/modified
140 # dir2/untracked
@@ -279,23 +273,19 @@ and have 1 and 2 different commits each, respectively.
273
274 Changes to be committed:
275 (use "git restore --staged <file>..." to unstage)
282 -
276 new file: dir2/added
277
278 Changes not staged for commit:
279 (use "git add <file>..." to update what will be committed)
280 (use "git restore <file>..." to discard changes in working directory)
288 -
281 modified: dir1/modified
282
283 Untracked files:
284 (use "git add <file>..." to include in what will be committed)
293 -
285 dir2/modified
286
287 Ignored files:
288 (use "git add -f <file>..." to include in what will be committed)
298 -
289 .gitignore
290 dir1/untracked
291 dir2/untracked
@@ -348,18 +338,15 @@ and have 1 and 2 different commits each, respectively.
338
339 Changes to be committed:
340 (use "git restore --staged <file>..." to unstage)
351 -
341 new file: dir2/added
342
343 Changes not staged for commit:
344 (use "git add <file>..." to update what will be committed)
345 (use "git restore <file>..." to discard changes in working directory)
357 -
346 modified: dir1/modified
347
348 Ignored files:
349 (use "git add -f <file>..." to include in what will be committed)
362 -
350 .gitignore
351 dir1/untracked
352 dir2/modified
@@ -421,13 +408,11 @@ and have 1 and 2 different commits each, respectively.
408
409 Changes to be committed:
410 (use "git restore --staged <file>..." to unstage)
424 -
411 new file: dir2/added
412
413 Changes not staged for commit:
414 (use "git add <file>..." to update what will be committed)
415 (use "git restore <file>..." to discard changes in working directory)
430 -
416 modified: dir1/modified
417
418 Untracked files not listed (use -u option to show untracked files)
@@ -485,18 +470,15 @@ and have 1 and 2 different commits each, respectively.
470
471 Changes to be committed:
472 (use "git restore --staged <file>..." to unstage)
488 -
473 new file: dir2/added
474
475 Changes not staged for commit:
476 (use "git add <file>..." to update what will be committed)
477 (use "git restore <file>..." to discard changes in working directory)
494 -
478 modified: dir1/modified
479
480 Untracked files:
481 (use "git add <file>..." to include in what will be committed)
499 -
482 dir1/untracked
483 dir2/modified
484 dir2/untracked
@@ -543,18 +525,15 @@ and have 1 and 2 different commits each, respectively.
525
526 Changes to be committed:
527 (use "git restore --staged <file>..." to unstage)
546 -
528 new file: dir2/added
529
530 Changes not staged for commit:
531 (use "git add <file>..." to update what will be committed)
532 (use "git restore <file>..." to discard changes in working directory)
552 -
533 modified: dir1/modified
534
535 Untracked files:
536 (use "git add <file>..." to include in what will be committed)
557 -
537 dir1/untracked
538 dir2/modified
539 dir2/untracked
@@ -606,18 +585,15 @@ and have 1 and 2 different commits each, respectively.
585
586 Changes to be committed:
587 (use "git restore --staged <file>..." to unstage)
609 -
588 new file: ../dir2/added
589
590 Changes not staged for commit:
591 (use "git add <file>..." to update what will be committed)
592 (use "git restore <file>..." to discard changes in working directory)
615 -
593 modified: modified
594
595 Untracked files:
596 (use "git add <file>..." to include in what will be committed)
620 -
597 untracked
598 ../dir2/modified
599 ../dir2/untracked
@@ -677,18 +653,15 @@ and have 1 and 2 different commits each, respectively.
653
654 Changes to be committed:
655 (use "git restore --staged <file>..." to unstage)
680 -
656 <GREEN>new file: dir2/added<RESET>
657
658 Changes not staged for commit:
659 (use "git add <file>..." to update what will be committed)
660 (use "git restore <file>..." to discard changes in working directory)
686 -
661 <RED>modified: dir1/modified<RESET>
662
663 Untracked files:
664 (use "git add <file>..." to include in what will be committed)
691 -
665 <BLUE>dir1/untracked<RESET>
666 <BLUE>dir2/modified<RESET>
667 <BLUE>dir2/untracked<RESET>
@@ -803,18 +776,15 @@ and have 1 and 2 different commits each, respectively.
776
777 Changes to be committed:
778 (use "git restore --staged <file>..." to unstage)
806 -
779 new file: dir2/added
780
781 Changes not staged for commit:
782 (use "git add <file>..." to update what will be committed)
783 (use "git restore <file>..." to discard changes in working directory)
812 -
784 modified: dir1/modified
785
786 Untracked files:
787 (use "git add <file>..." to include in what will be committed)
817 -
788 dir1/untracked
789 dir2/modified
790 dir2/untracked
@@ -853,12 +823,10 @@ and have 1 and 2 different commits each, respectively.
823
824 Changes to be committed:
825 (use "git restore --staged <file>..." to unstage)
856 -
826 modified: dir1/modified
827
828 Untracked files:
829 (use "git add <file>..." to include in what will be committed)
861 -
830 dir1/untracked
831 dir2/
832 untracked
@@ -897,19 +865,16 @@ and have 1 and 2 different commits each, respectively.
865
866 Changes to be committed:
867 (use "git restore --staged <file>..." to unstage)
900 -
868 new file: dir2/added
869 new file: sm
870
871 Changes not staged for commit:
872 (use "git add <file>..." to update what will be committed)
873 (use "git restore <file>..." to discard changes in working directory)
907 -
874 modified: dir1/modified
875
876 Untracked files:
877 (use "git add <file>..." to include in what will be committed)
912 -
878 dir1/untracked
879 dir2/modified
880 dir2/untracked
@@ -957,14 +922,12 @@ and have 1 and 2 different commits each, respectively.
922
923 Changes to be committed:
924 (use "git restore --staged <file>..." to unstage)
960 -
925 new file: dir2/added
926 new file: sm
927
928 Changes not staged for commit:
929 (use "git add <file>..." to update what will be committed)
930 (use "git restore <file>..." to discard changes in working directory)
967 -
931 modified: dir1/modified
932
933 Submodule changes to be committed:
@@ -974,7 +937,6 @@ Submodule changes to be committed:
937
938 Untracked files:
939 (use "git add <file>..." to include in what will be committed)
977 -
940 dir1/untracked
941 dir2/modified
942 dir2/untracked
@@ -1020,12 +982,10 @@ and have 2 and 2 different commits each, respectively.
982 Changes not staged for commit:
983 (use "git add <file>..." to update what will be committed)
984 (use "git restore <file>..." to discard changes in working directory)
1023 -
985 modified: dir1/modified
986
987 Untracked files:
988 (use "git add <file>..." to include in what will be committed)
1028 -
989 dir1/untracked
990 dir2/modified
991 dir2/untracked
@@ -1069,14 +1029,12 @@ and have 2 and 2 different commits each, respectively.
1029
1030 Changes to be committed:
1031 (use "git restore --source=HEAD^1 --staged <file>..." to unstage)
1072 -
1032 new file: dir2/added
1033 new file: sm
1034
1035 Changes not staged for commit:
1036 (use "git add <file>..." to update what will be committed)
1037 (use "git restore <file>..." to discard changes in working directory)
1079 -
1038 modified: dir1/modified
1039
1040 Submodule changes to be committed:
@@ -1086,7 +1044,6 @@ Submodule changes to be committed:
1044
1045 Untracked files:
1046 (use "git add <file>..." to include in what will be committed)
1089 -
1047 dir1/untracked
1048 dir2/modified
1049 dir2/untracked
@@ -1124,13 +1081,11 @@ and have 2 and 2 different commits each, respectively.
1081
1082 Changes to be committed:
1083 (use "git restore --staged <file>..." to unstage)
1127 -
1084 modified: sm
1085
1086 Changes not staged for commit:
1087 (use "git add <file>..." to update what will be committed)
1088 (use "git restore <file>..." to discard changes in working directory)
1133 -
1089 modified: dir1/modified
1090
1091 Submodule changes to be committed:
@@ -1140,7 +1095,6 @@ Submodule changes to be committed:
1095
1096 Untracked files:
1097 (use "git add <file>..." to include in what will be committed)
1143 -
1098 .gitmodules
1099 dir1/untracked
1100 dir2/modified
@@ -1236,14 +1190,12 @@ and have 2 and 2 different commits each, respectively.
1190
1191 Changes to be committed:
1192 (use "git restore --staged <file>..." to unstage)
1239 -
1193 modified: sm
1194
1195 Changes not staged for commit:
1196 (use "git add <file>..." to update what will be committed)
1197 (use "git restore <file>..." to discard changes in working directory)
1198 (commit or discard the untracked or modified content in submodules)
1246 -
1199 modified: dir1/modified
1200 modified: sm (modified content)
1201
@@ -1254,7 +1206,6 @@ Submodule changes to be committed:
1206
1207 Untracked files:
1208 (use "git add <file>..." to include in what will be committed)
1257 -
1209 .gitmodules
1210 dir1/untracked
1211 dir2/modified
@@ -1296,13 +1247,11 @@ and have 2 and 2 different commits each, respectively.
1247
1248 Changes to be committed:
1249 (use "git restore --staged <file>..." to unstage)
1299 -
1250 modified: sm
1251
1252 Changes not staged for commit:
1253 (use "git add <file>..." to update what will be committed)
1254 (use "git restore <file>..." to discard changes in working directory)
1305 -
1255 modified: dir1/modified
1256 modified: sm (new commits)
1257
@@ -1318,7 +1267,6 @@ Submodules changed but not updated:
1267
1268 Untracked files:
1269 (use "git add <file>..." to include in what will be committed)
1321 -
1270 .gitmodules
1271 dir1/untracked
1272 dir2/modified
@@ -1380,13 +1328,11 @@ cat > expect << EOF
1328 ;
1329 ; Changes to be committed:
1330 ; (use "git restore --staged <file>..." to unstage)
1383 -;
1331 ; modified: sm
1332 ;
1333 ; Changes not staged for commit:
1334 ; (use "git add <file>..." to update what will be committed)
1335 ; (use "git restore <file>..." to discard changes in working directory)
1389 -;
1336 ; modified: dir1/modified
1337 ; modified: sm (new commits)
1338 ;
@@ -1402,7 +1348,6 @@ cat > expect << EOF
1348 ;
1349 ; Untracked files:
1350 ; (use "git add <file>..." to include in what will be committed)
1405 -;
1351 ; .gitmodules
1352 ; dir1/untracked
1353 ; dir2/modified
@@ -1432,12 +1377,10 @@ and have 2 and 2 different commits each, respectively.
1377 Changes not staged for commit:
1378 (use "git add <file>..." to update what will be committed)
1379 (use "git restore <file>..." to discard changes in working directory)
1435 -
1380 modified: dir1/modified
1381
1382 Untracked files:
1383 (use "git add <file>..." to include in what will be committed)
1440 -
1384 .gitmodules
1385 dir1/untracked
1386 dir2/modified
@@ -1459,18 +1402,15 @@ and have 2 and 2 different commits each, respectively.
1402
1403 Changes to be committed:
1404 (use "git restore --staged <file>..." to unstage)
1462 -
1405 modified: sm
1406
1407 Changes not staged for commit:
1408 (use "git add <file>..." to update what will be committed)
1409 (use "git restore <file>..." to discard changes in working directory)
1468 -
1410 modified: dir1/modified
1411
1412 Untracked files:
1413 (use "git add <file>..." to include in what will be committed)
1473 -
1414 .gitmodules
1415 dir1/untracked
1416 dir2/modified
@@ -1582,13 +1522,11 @@ and have 2 and 2 different commits each, respectively.
1522
1523 Changes to be committed:
1524 (use "git restore --staged <file>..." to unstage)
1585 -
1525 modified: sm
1526
1527 Changes not staged for commit:
1528 (use "git add <file>..." to update what will be committed)
1529 (use "git restore <file>..." to discard changes in working directory)
1591 -
1530 modified: dir1/modified
1531
1532 Untracked files not listed (use -u option to show untracked files)
t/t7512-status-help.sh
-14
@@ -33,7 +33,6 @@ You have unmerged paths.
33
34 Unmerged paths:
35 (use "git add <file>..." to mark resolution)
36 -
36 both modified: main.txt
37
38 no changes added to commit (use "git add" and/or "git commit -a")
@@ -54,7 +53,6 @@ All conflicts fixed but you are still merging.
53 (use "git commit" to conclude merge)
54
55 Changes to be committed:
57 -
56 modified: main.txt
57
58 Untracked files not listed (use -u option to show untracked files)
@@ -87,7 +85,6 @@ You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
85 Unmerged paths:
86 (use "git restore --staged <file>..." to unstage)
87 (use "git add <file>..." to mark resolution)
90 -
88 both modified: main.txt
89
90 no changes added to commit (use "git add" and/or "git commit -a")
@@ -111,7 +108,6 @@ You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
108
109 Changes to be committed:
110 (use "git restore --staged <file>..." to unstage)
114 -
111 modified: main.txt
112
113 Untracked files not listed (use -u option to show untracked files)
@@ -150,7 +146,6 @@ You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO
146 Unmerged paths:
147 (use "git restore --staged <file>..." to unstage)
148 (use "git add <file>..." to mark resolution)
153 -
149 both modified: main.txt
150
151 no changes added to commit (use "git add" and/or "git commit -a")
@@ -177,7 +172,6 @@ You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO
172
173 Changes to be committed:
174 (use "git restore --staged <file>..." to unstage)
180 -
175 modified: main.txt
176
177 Untracked files not listed (use -u option to show untracked files)
@@ -247,7 +241,6 @@ You are currently splitting a commit while rebasing branch '\''split_commit'\''
241 Changes not staged for commit:
242 (use "git add <file>..." to update what will be committed)
243 (use "git restore <file>..." to discard changes in working directory)
250 -
244 modified: main.txt
245
246 no changes added to commit (use "git add" and/or "git commit -a")
@@ -355,7 +348,6 @@ You are currently splitting a commit while rebasing branch '\''several_edits'\''
348 Changes not staged for commit:
349 (use "git add <file>..." to update what will be committed)
350 (use "git restore <file>..." to discard changes in working directory)
358 -
351 modified: main.txt
352
353 no changes added to commit (use "git add" and/or "git commit -a")
@@ -454,7 +446,6 @@ You are currently splitting a commit while rebasing branch '\''several_edits'\''
446 Changes not staged for commit:
447 (use "git add <file>..." to update what will be committed)
448 (use "git restore <file>..." to discard changes in working directory)
457 -
449 modified: main.txt
450
451 no changes added to commit (use "git add" and/or "git commit -a")
@@ -558,7 +549,6 @@ You are currently splitting a commit while rebasing branch '\''several_edits'\''
549 Changes not staged for commit:
550 (use "git add <file>..." to update what will be committed)
551 (use "git restore <file>..." to discard changes in working directory)
561 -
552 modified: main.txt
553
554 no changes added to commit (use "git add" and/or "git commit -a")
@@ -747,7 +737,6 @@ You are currently cherry-picking commit $TO_CHERRY_PICK.
737
738 Unmerged paths:
739 (use "git add <file>..." to mark resolution)
750 -
740 both modified: main.txt
741
742 no changes added to commit (use "git add" and/or "git commit -a")
@@ -771,7 +760,6 @@ You are currently cherry-picking commit $TO_CHERRY_PICK.
760 (use "git cherry-pick --abort" to cancel the cherry-pick operation)
761
762 Changes to be committed:
774 -
763 modified: main.txt
764
765 Untracked files not listed (use -u option to show untracked files)
@@ -818,7 +806,6 @@ You are currently reverting commit $TO_REVERT.
806 Unmerged paths:
807 (use "git restore --staged <file>..." to unstage)
808 (use "git add <file>..." to mark resolution)
821 -
809 both modified: to-revert.txt
810
811 no changes added to commit (use "git add" and/or "git commit -a")
@@ -838,7 +825,6 @@ You are currently reverting commit $TO_REVERT.
825
826 Changes to be committed:
827 (use "git restore --staged <file>..." to unstage)
841 -
828 modified: to-revert.txt
829
830 Untracked files not listed (use -u option to show untracked files)
wt-status.c
-4
@@ -199,7 +199,6 @@ static void wt_longstatus_print_unmerged_header(struct wt_status *s)
199 } else {
200 status_printf_ln(s, c, _(" (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
201 }
202 - status_printf_ln(s, c, "%s", "");
202 }
203
204 static void wt_longstatus_print_cached_header(struct wt_status *s)
@@ -221,7 +220,6 @@ static void wt_longstatus_print_cached_header(struct wt_status *s)
220 s->reference);
221 } else
222 status_printf_ln(s, c, _(" (use \"git rm --cached <file>...\" to unstage)"));
224 - status_printf_ln(s, c, "%s", "");
223 }
224
225 static void wt_longstatus_print_dirty_header(struct wt_status *s,
@@ -240,7 +238,6 @@ static void wt_longstatus_print_dirty_header(struct wt_status *s,
238 status_printf_ln(s, c, _(" (use \"git restore <file>...\" to discard changes in working directory)"));
239 if (has_dirty_submodules)
240 status_printf_ln(s, c, _(" (commit or discard the untracked or modified content in submodules)"));
243 - status_printf_ln(s, c, "%s", "");
241 }
242
243 static void wt_longstatus_print_other_header(struct wt_status *s,
@@ -252,7 +249,6 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
249 if (!s->hints)
250 return;
251 status_printf_ln(s, c, _(" (use \"git %s <file>...\" to include in what will be committed)"), how);
255 - status_printf_ln(s, c, "%s", "");
252 }
253
254 static void wt_longstatus_print_trailer(struct wt_status *s)