wt-status: lift the artificual "at least 20 columns" floor

When we show unmerged paths, we had an artificial 20 columns floor for the width of labels (e.g. "both deleted:") shown next to the pathnames. Depending on the locale, this may result in a label that is too wide when all the label strings are way shorter than 20 columns, or no-op when a label string is longer than 20 columns. Just drop the artificial floor. The screen real estate is better utilized this way when all the strings are shorter. Adjust the tests to this change. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 12, 2014 at 13:43 UTC c7cb333f60db9b8313da75c2075a3619202e905d
3 files changed +13 -15
t/t7060-wtstatus.sh
+7 -7
@@ -38,7 +38,7 @@ You have unmerged paths.
38 Unmerged paths:
39 (use "git add/rm <file>..." as appropriate to mark resolution)
40
41 - deleted by us: foo
41 + deleted by us: foo
42
43 no changes added to commit (use "git add" and/or "git commit -a")
44 EOF
@@ -142,8 +142,8 @@ You have unmerged paths.
142 Unmerged paths:
143 (use "git add/rm <file>..." as appropriate to mark resolution)
144
145 - both added: conflict.txt
146 - deleted by them: main.txt
145 + both added: conflict.txt
146 + deleted by them: main.txt
147
148 no changes added to commit (use "git add" and/or "git commit -a")
149 EOF
@@ -175,9 +175,9 @@ You have unmerged paths.
175 Unmerged paths:
176 (use "git add/rm <file>..." as appropriate to mark resolution)
177
178 - both deleted: main.txt
179 - added by them: sub_master.txt
180 - added by us: sub_second.txt
178 + both deleted: main.txt
179 + added by them: sub_master.txt
180 + added by us: sub_second.txt
181
182 no changes added to commit (use "git add" and/or "git commit -a")
183 EOF
@@ -203,7 +203,7 @@ Changes to be committed:
203 Unmerged paths:
204 (use "git rm <file>..." to mark resolution)
205
206 - both deleted: main.txt
206 + both deleted: main.txt
207
208 Untracked files not listed (use -u option to show untracked files)
209 EOF
t/t7512-status-help.sh
+6 -6
@@ -33,7 +33,7 @@ You have unmerged paths.
33 Unmerged paths:
34 (use "git add <file>..." to mark resolution)
35
36 - both modified: main.txt
36 + both modified: main.txt
37
38 no changes added to commit (use "git add" and/or "git commit -a")
39 EOF
@@ -87,7 +87,7 @@ Unmerged paths:
87 (use "git reset HEAD <file>..." to unstage)
88 (use "git add <file>..." to mark resolution)
89
90 - both modified: main.txt
90 + both modified: main.txt
91
92 no changes added to commit (use "git add" and/or "git commit -a")
93 EOF
@@ -146,7 +146,7 @@ Unmerged paths:
146 (use "git reset HEAD <file>..." to unstage)
147 (use "git add <file>..." to mark resolution)
148
149 - both modified: main.txt
149 + both modified: main.txt
150
151 no changes added to commit (use "git add" and/or "git commit -a")
152 EOF
@@ -602,7 +602,7 @@ rebase in progress; onto $ONTO
602 You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''.
603
604 Unmerged paths:
605 - both modified: main.txt
605 + both modified: main.txt
606
607 no changes added to commit
608 EOF
@@ -636,7 +636,7 @@ You are currently cherry-picking commit $TO_CHERRY_PICK.
636 Unmerged paths:
637 (use "git add <file>..." to mark resolution)
638
639 - both modified: main.txt
639 + both modified: main.txt
640
641 no changes added to commit (use "git add" and/or "git commit -a")
642 EOF
@@ -707,7 +707,7 @@ Unmerged paths:
707 (use "git reset HEAD <file>..." to unstage)
708 (use "git add <file>..." to mark resolution)
709
710 - both modified: to-revert.txt
710 + both modified: to-revert.txt
711
712 no changes added to commit (use "git add" and/or "git commit -a")
713 EOF
wt-status.c
-2
@@ -318,8 +318,6 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
318 if (!padding) {
319 label_width = maxwidth(wt_status_unmerged_status_string, 1, 7);
320 label_width += strlen(" ");
321 - if (label_width < 20)
322 - label_width = 20;
321 padding = xmallocz(label_width);
322 memset(padding, ' ', label_width);
323 }