提交 7cd17e80 编写于 作者: J Jeff King 提交者: Junio C Hamano

show-branch: avoid segfault with --reflog of unborn branch

When no branch is given to the "--reflog" option, we resolve
HEAD to get the default branch. However, if HEAD points to
an unborn branch, resolve_ref returns NULL, and we later
segfault trying to access it.
Signed-off-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 8d530c4d
......@@ -743,6 +743,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
fake_av[1] = NULL;
av = fake_av;
ac = 1;
if (!*av)
die("no branches given, and HEAD is not valid");
}
if (ac != 1)
die("--reflog option needs one branch name");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册