Re: git describe --tags --long barfs on new tags?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(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;
 	}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux