From: Shawn O. Pearce Date: Thu, 3 Jul 2008 02:32:45 +0000 (+0000) Subject: Fix describe --tags --long so it does not segfault X-Git-Tag: v1.5.6.2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=14d4642e2a472ba4c06e10a3f5623d944b869314;p=git.git Fix describe --tags --long so it does not segfault If we match a lightweight (non-annotated tag) as the name to output and --long was requested we do not have a tag, nor do we have a tagged object to display. Instead we must use the object we were passed as input for the long format display. Reported-by: Mark Burton Backtraced-by: Mikael Magnusson Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- diff --git a/builtin-describe.c b/builtin-describe.c index 3da99c1d0..e515f9ca9 100644 --- a/builtin-describe.c +++ b/builtin-describe.c @@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one) */ display_name(n); if (longformat) - show_suffix(0, n->tag->tagged->sha1); + show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1); printf("\n"); return; } diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index c6be2597f..2fb672c3b 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -139,4 +139,6 @@ check_describe "test1-lightweight-*" --tags --match="test1-*" check_describe "test2-lightweight-*" --tags --match="test2-*" +check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^ + test_done