@matheusbsbs / matheus-bagliano / commits / 14d4642e2a
Fork 0

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 <markb@ordern.com> Backtraced-by: Mikael Magnusson <mikachu@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Jul 3, 2008 at 02:32 UTC 14d4642e2a472ba4c06e10a3f5623d944b869314
2 files changed +3 -1
builtin-describe.c
+1 -1
@@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one)
204 */
205 display_name(n);
206 if (longformat)
207 - show_suffix(0, n->tag->tagged->sha1);
207 + show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
208 printf("\n");
209 return;
210 }
t/t6120-describe.sh
+2
@@ -139,4 +139,6 @@ check_describe "test1-lightweight-*" --tags --match="test1-*"
139
140 check_describe "test2-lightweight-*" --tags --match="test2-*"
141
142 +check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^
143 +
144 test_done