Skip to content

Commit

Permalink
Fix describe --tags --long so it does not segfault
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
spearce authored and gitster committed Jul 3, 2008
1 parent 7ad0f27 commit 14d4642
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-describe.c
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions t/t6120-describe.sh
Expand Up @@ -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

0 comments on commit 14d4642

Please sign in to comment.