git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Abhijit Menon-Sen <ams@toroid.org>
To: git@vger.kernel.org
Cc: Mark Burton <markb@ordern.com>, Mikael Magnuson <mikachu@gmail.com>
Subject: Re: git describe --tags --long barfs on new tags?
Date: Thu, 3 Jul 2008 08:19:56 +0530	[thread overview]
Message-ID: <20080703024956.GA1080@toroid.org> (raw)
In-Reply-To: <237967ef0807021256j3e67bceaoecbb8f37112db2ab@mail.gmail.com>

(Sorry for the broken References. I deleted the message before realising
that I wanted to reply to it; and I couldn't easily find an mbox archive
to snarf the whole message from.)

> ~/git[master]$ git tag mb
> ~/git[master]$ git describe
> v1.5.6.1-156-ge903b40
> ~/git[master]$ git describe --tags
> mb
> ~/git[master]$ git describe --tags --long
> Segmentation fault (core dumped)

Not on new tags, but on un-annotated ones (which the --tags brings into
consideration). The appended patch fixes the problem for me, but I'd be
grateful if someone could confirm that it's the right thing to do.

-- ams

diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1..7ed4757 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -203,8 +203,12 @@ static void describe(const char *arg, int last_one)
 		 * Exact match to an existing ref.
 		 */
 		display_name(n);
-		if (longformat)
-			show_suffix(0, n->tag->tagged->sha1);
+		if (longformat) {
+			const unsigned char *sha1 = n->sha1;
+			if (n->tag)
+				sha1 = n->tag->tagged->sha1;
+			show_suffix(0, sha1);
+		}
 		printf("\n");
 		return;
 	}

      parent reply	other threads:[~2008-07-03  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02 14:45 git describe --tags --long barfs on new tags? Mark Burton
2008-07-02 19:56 ` Mikael Magnusson
2008-07-03  2:32   ` [PATCH] Fix describe --tags --long so it does not segfault Shawn O. Pearce
2008-07-03  4:23     ` Junio C Hamano
2008-07-03  2:49   ` Abhijit Menon-Sen [this message]

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=20080703024956.GA1080@toroid.org \
    --to=ams@toroid.org \
    --cc=git@vger.kernel.org \
    --cc=markb@ordern.com \
    --cc=mikachu@gmail.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).