aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-04-09 14:31:43 -0700
committerJunio C Hamano <gitster@pobox.com>2024-04-09 14:31:43 -0700
commit39b2c6f77ed451ed9ea4080aa878f6d25f21ecc4 (patch)
treecc44cf331cb86dde59c31cf6fa10ffc2bc248f2d
parent8289a36f8725d33f5bdff2a5aeaa0b0369ad8ff8 (diff)
parent2d8cf94b28de9da683ddd40961a3a572f2741cf3 (diff)
downloadgit-39b2c6f77ed451ed9ea4080aa878f6d25f21ecc4.tar.gz
Merge branch 'jc/advice-sans-trailing-whitespace'
The "hint:" messages given by the advice mechanism, when given a message with a blank line, left a line with trailing whitespace, which has been cleansed. * jc/advice-sans-trailing-whitespace: advice: omit trailing whitespace
-rw-r--r--advice.c3
-rwxr-xr-xt/t3200-branch.sh4
-rwxr-xr-xt/t7004-tag.sh4
3 files changed, 6 insertions, 5 deletions
diff --git a/advice.c b/advice.c
index d19648b7f8..75111191ad 100644
--- a/advice.c
+++ b/advice.c
@@ -105,8 +105,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)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index d3bbd00b81..ccfa6a720d 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -1154,9 +1154,9 @@ test_expect_success 'avoid ambiguous track and advise' '
hint: tracking ref '\''refs/heads/main'\'':
hint: ambi1
hint: ambi2
- hint: ''
+ hint:
hint: This is typically a configuration error.
- hint: ''
+ hint:
hint: To support setting up tracking branches, ensure that
hint: different remotes'\'' fetch refspecs map into different
hint: tracking namespaces.
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index b41a47eb94..696866d779 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1777,10 +1777,10 @@ test_expect_success '--points-at finds annotated tags of tags' '
'
test_expect_success 'recursive tagging should give advice' '
- sed -e "s/|$//" <<-EOF >expect &&
+ cat >expect <<-EOF &&
hint: You have created a nested tag. The object referred to by your new tag is
hint: already a tag. If you meant to tag the object that it points to, use:
- hint: |
+ hint:
hint: git tag -f nested annotated-v4.0^{}
hint: Disable this message with "git config advice.nestedTag false"
EOF