Allow builtin-fetch to work on a detached HEAD
If we are running fetch in a repository that has a detached HEAD then there is no current_branch available. In such a case any ref that the fetch might update by definition cannot also be the current branch so we should always bypass the "don't update HEAD" test. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e5f4e21463
commit
b3abdd9d21
@ -151,7 +151,8 @@ static int update_local_ref(struct ref *ref,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(ref->name, current_branch->name) &&
|
if (current_branch &&
|
||||||
|
!strcmp(ref->name, current_branch->name) &&
|
||||||
!(update_head_ok || is_bare_repository()) &&
|
!(update_head_ok || is_bare_repository()) &&
|
||||||
!is_null_sha1(ref->old_sha1)) {
|
!is_null_sha1(ref->old_sha1)) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user