зеркало из https://github.com/microsoft/git.git
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: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
f800b65bea
Коммит
55f0566f6d
2
remote.c
2
remote.c
|
@ -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 *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);
|
for_each_ref(one_local_ref, &local_tail);
|
||||||
return local_refs;
|
return local_refs;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче