提交 55f0566f 编写于 作者: N Nguyễn Thái Ngọc Duy 提交者: Junio C Hamano

get_local_heads(): do not return random pointer if there is no head

it's silly to do this:

mkdir foo && cd foo && git init && git push somewhere.git

but segfault should not happen even in that case.
Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 f800b65b
......@@ -1504,7 +1504,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1, int fla
struct ref *get_local_heads(void)
{
struct ref *local_refs, **local_tail = &local_refs;
struct ref *local_refs = NULL, **local_tail = &local_refs;
for_each_ref(one_local_ref, &local_tail);
return local_refs;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册