aboutsummaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-04-27 05:01:05 -0400
committerJunio C Hamano <gitster@pobox.com>2017-04-28 11:40:52 +0900
commit75177c8591aee23374c2ead9c9505ce989a8eec2 (patch)
treeebb10a42b2981929e7f0f6c2e95c880dcc0d6cef /wt-status.c
parent027a3b943b444a3e3a76f9a89803fc10245b858f (diff)
downloadgit-75177c8591aee23374c2ead9c9505ce989a8eec2.tar.gz
git-75177c8591aee23374c2ead9c9505ce989a8eec2.tar.xz
status: fix missing newline when comment chars are disabled
When git-status shows tracking data for the current branch in the long format, we try to end the stanza with a blank line. When status.displayCommentPrefix is true, we call color_fprintf_ln() to do so. But when it's false, we call the enigmatic: fputs("", s->fp); which does nothing at all! This is a bug from 7d7d68022 (silence a bunch of format-zero-length warnings, 2014-05-04). Prior to that, we called fprintf_ln() with an empty string. Switching to fputs() meant we needed to include the "newline in the string, but we didn't. So you see: On branch jk/status-tracking-newline Your branch is ahead of 'origin/master' by 1 commit. Changes not staged for commit: modified: foo Untracked files: bar whereas there should be a blank line before the "Changes not staged" line. The fix itself is a one-liner. But we never noticed this bug because t7508 doesn't exercise the ahead/behind code at all. So let's configure an upstream during the initial setup, which means that the code will be exercised as part of all of the various invocations in that script. This makes the diff rather noisy, but should give us good coverage. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wt-status.c b/wt-status.c
index 037548496..b7ade902f 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1002,7 +1002,7 @@ static void wt_longstatus_print_tracking(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
comment_line_char);
else
- fputs("", s->fp);
+ fputs("\n", s->fp);
}
static int has_unmerged(struct wt_status *s)