git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] git show <tag>: show the tagger
Date: Tue, 18 Dec 2007 18:01:33 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0712181800250.23902@racer.site> (raw)


For commit objects, the Author is shown, so do the equivalent for
tag objects, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	I know, it's feature freeze period.  But this is arguably a 
	usability bug.

	Well, it's not _that_ serious, so it could wait for 2.0.0, too ;-)

 builtin-log.c |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index cc3cc90..c2ad863 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -244,7 +244,29 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
 	return cmd_log_walk(&rev);
 }
 
-static int show_object(const unsigned char *sha1, int suppress_header)
+static void show_tagger(char *buf, int len, struct rev_info *rev)
+{
+	char *email_end, *p;
+	unsigned long date;
+	int tz;
+
+	email_end = memchr(buf, '>', len);
+	if (!email_end)
+		return;
+	p = ++email_end;
+	while (isspace(*p))
+		p++;
+	date = strtoul(p, &p, 10);
+	while (isspace(*p))
+		p++;
+	tz = (int)strtol(p, NULL, 10);
+	printf("Tagger: %.*s\nDate:   %s\n",
+			email_end - buf, buf,
+			show_date(date, tz, rev->date_mode));
+}
+
+static int show_object(const unsigned char *sha1, int show_tag_object,
+	struct rev_info *rev)
 {
 	unsigned long size;
 	enum object_type type;
@@ -254,11 +276,14 @@ static int show_object(const unsigned char *sha1, int suppress_header)
 	if (!buf)
 		return error("Could not read object %s", sha1_to_hex(sha1));
 
-	if (suppress_header)
-		while (offset < size && buf[offset++] != '\n') {
-			int new_offset = offset;
+	if (show_tag_object)
+		while (offset < size && buf[offset] != '\n') {
+			int new_offset = offset + 1;
 			while (new_offset < size && buf[new_offset++] != '\n')
 				; /* do nothing */
+			if (!prefixcmp(buf + offset, "tagger "))
+				show_tagger(buf + offset + 7,
+					    new_offset - offset - 7, rev);
 			offset = new_offset;
 		}
 
@@ -299,16 +324,16 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 		const char *name = objects[i].name;
 		switch (o->type) {
 		case OBJ_BLOB:
-			ret = show_object(o->sha1, 0);
+			ret = show_object(o->sha1, 0, NULL);
 			break;
 		case OBJ_TAG: {
 			struct tag *t = (struct tag *)o;
 
-			printf("%stag %s%s\n\n",
+			printf("%stag %s%s\n",
 					diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
 					t->tag,
 					diff_get_color_opt(&rev.diffopt, DIFF_RESET));
-			ret = show_object(o->sha1, 1);
+			ret = show_object(o->sha1, 1, &rev);
 			objects[i].item = (struct object *)t->tagged;
 			i--;
 			break;
-- 
1.5.4.rc0.70.g30f7

             reply	other threads:[~2007-12-18 18:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18 18:01 Johannes Schindelin [this message]
2007-12-18 20:10 ` [PATCH] git show <tag>: show the tagger Junio C Hamano
2007-12-18 21:33   ` Jakub Narebski
2007-12-19  9:11 ` Andreas Ericsson

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=Pine.LNX.4.64.0712181800250.23902@racer.site \
    --to=johannes.schindelin@gmx.de \
    --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).