Re: git describe --tags --long barfs on new tags?
- From
- Abhijit Menon-Sen <ams@toroid.org>
- Date
- Jul 3, 2008, 02:49 UTC
- Message-ID
- <20080703024956.GA1080@toroid.org>
- 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.)
Show 7 quoted lines
> ~/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; }