All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] show: add space between tag body and tagged object
Date: Fri, 17 Jul 2009 19:22:28 -0400	[thread overview]
Message-ID: <20090717232227.GB13624@coredump.intra.peff.net> (raw)
In-Reply-To: <20090717231622.GA13511@coredump.intra.peff.net>

When showing an annotated tag, "git show" will always
display the pointed-to object. However, it didn't separate
the two with whitespace, making it more difficult to notice
where the new object started. For example:

  $ git tag -m 'my message' foo
  $ git show foo
  tag foo
  Tagger: Jeff King <peff@peff.net>
  Date:   Fri Jul 17 18:46:25 2009 -0400

  my message
  commit 41cabf8fed2694ba33e01d64f9094f2fc5e5805a
  Author: Jeff King <peff@peff.net>
  Date:   Thu Jul 16 17:31:34 2009 -0400
  ...

This patch adds a blank line between "my message" and
"commit 41c...", making it easier to read.

Signed-off-by: Jeff King <peff@peff.net>
---
I was tempted to add logic for "put a blank line separator between each
two items printed by git show", instead of just tags. But:

  - commits already do that (e.g., "git show HEAD HEAD^" looks fine)

  - blobs don't do it, but you probably don't want them to. I don't know
    why you would really do "git show HEAD:foo HEAD:bar", but you could,
    and I would expect it to concatenate them without extra data.

Trees don't do it, so if you "git show HEAD^{tree} HEAD^{tree}" there is
no separator. Maybe that is worth fixing separately, but I find it
unlikely for somebody to do that. Annotated tags are the much more
common case, because you always get two objects displayed.

 builtin-log.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index b05796d..d3e4d1a 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -342,6 +342,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 					    sha1_to_hex(t->tagged->sha1));
 			objects[i].item = o;
 			i--;
+			putchar('\n');
 			break;
 		}
 		case OBJ_TREE:
-- 
1.6.4.rc1.174.g317bf.dirty

  parent reply	other threads:[~2009-07-17 23:22 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 ` [PATCH 1/2] show: suppress extra newline when showing annotated tag Jeff King
2009-07-18  3:25   ` [PATCH 1/2] " Nicolas Sebrecht
2009-07-18  3:47     ` Jeff King
2009-07-17 23:22 ` Jeff King [this message]
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=20090717232227.GB13624@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.