get_local_heads(): do not return random pointer if there is no head
PATCH 1/1 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 <[email protected]>
--- remote.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
remote.c +1 -1
@@ -1493,7 +1493,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1, int flastruct 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; }
Signature · 1 line
1.6.2.2.693.g5a1be
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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.
Thanks.