aboutsummaryrefslogtreecommitdiffstats
path: root/advice.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-29 15:57:06 -0700
committerJunio C Hamano <gitster@pobox.com>2024-03-29 16:18:48 -0700
commit2d8cf94b28de9da683ddd40961a3a572f2741cf3 (patch)
treee45a00caff7d79ef9792bae2975338a53ed7cd31 /advice.c
parentd6fd04375f9196f8b203d442f235bd96a1a068cc (diff)
downloadgit-2d8cf94b28de9da683ddd40961a3a572f2741cf3.tar.gz
advice: omit trailing whitespace
Git tools all consistently encourage users to avoid whitespaces at the end of line by giving them features like "git diff --check" and "git am --whitespace=fix". Make sure that the advice messages we give users avoid trailing whitespaces. We shouldn't be wasting vertical screen real estate by adding blank lines in advice messages that are supposed to be concise hints, but as long as we write such blank line in our "hints", we should do it right. A test that expects the current behaviour of leaving trailing whitespaces has been adjusted. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'advice.c')
-rw-r--r--advice.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/advice.c b/advice.c
index b0e0550687..a18bfe776f 100644
--- a/advice.c
+++ b/advice.c
@@ -104,8 +104,9 @@ static void vadvise(const char *advice, int display_instructions,
for (cp = buf.buf; *cp; cp = np) {
np = strchrnul(cp, '\n');
- fprintf(stderr, _("%shint: %.*s%s\n"),
+ fprintf(stderr, _("%shint:%s%.*s%s\n"),
advise_get_color(ADVICE_COLOR_HINT),
+ (np == cp) ? "" : " ",
(int)(np - cp), cp,
advise_get_color(ADVICE_COLOR_RESET));
if (*np)