提交 14d4642e 编写于 作者: S Shawn O. Pearce 提交者: Junio C Hamano

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: NMark Burton <markb@ordern.com>
Backtraced-by: NMikael Magnusson <mikachu@gmail.com>
Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 7ad0f27b
......@@ -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;
}
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册