From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/2] show: suppress extra newline when showing annotated tag
Date: Fri, 17 Jul 2009 19:18:34 -0400 [thread overview]
Message-ID: <20090717231834.GA13624@coredump.intra.peff.net> (raw)
In-Reply-To: <20090717231622.GA13511@coredump.intra.peff.net>
When showing a tag, our header parsing finishes with the
offset pointing to the newline separating the tag header
from the tag body. This means that the printed body will
always start with a newline.
However, we also add an extra newline when printing the
tagger information. This leads to an ugly double-newline:
$ git show v1.6.3
tag v1.6.3
Tagger: Junio C Hamano <gitster@pobox.com>
Date: Wed May 6 18:16:47 2009 -0700
GIT 1.6.3
-----BEGIN PGP SIGNATURE-----
...
This patch removes the extra newline from the end of the
tagger headers. This is a better solution than suppressing
the separator newline, because it retains the behavior for
tags which have no tagger. E.g., "git show v0.99" will
continue to look like:
$ git show v0.99
tag v0.99
Test-release for wider distribution.
...
Signed-off-by: Jeff King <peff@peff.net>
---
I tried to consider the output for real-world cases. In theory, you
could have a corrupted tag with not only no body, but no newline
separator. Then it would display as:
tag foo
commit ...
with no extra newline. But since nothing should be generating such a
tag, I don't think it is a problem.
builtin-log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 0c2fa0a..b05796d 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -257,7 +257,7 @@ static void show_tagger(char *buf, int len, struct rev_info *rev)
pp_user_info("Tagger", rev->commit_format, &out, buf, rev->date_mode,
git_log_output_encoding ?
git_log_output_encoding: git_commit_encoding);
- printf("%s\n", out.buf);
+ printf("%s", out.buf);
strbuf_release(&out);
}
--
1.6.4.rc1.174.g317bf.dirty
next prev parent reply other threads:[~2009-07-17 23:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-17 23:16 [PATCH 0/2] cosmetic improvements for "git show tag" Jeff King
2009-07-17 23:18 ` Jeff King [this message]
2009-07-18 3:25 ` [PATCH 1/2] Re: show: suppress extra newline when showing annotated tag Nicolas Sebrecht
2009-07-18 3:47 ` Jeff King
2009-07-17 23:22 ` [PATCH 2/2] show: add space between tag body and tagged object Jeff King
2009-07-18 1:10 ` [PATCH 0/2] Re: cosmetic improvements for "git show tag" Nicolas Sebrecht
2009-07-18 1:47 ` Jeff King
2009-07-18 10:14 ` Jeff King
2009-07-19 18:05 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090717231834.GA13624@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).