From: Shawn O. Pearce Date: Sun, 16 Sep 2007 06:31:26 +0000 (-0400) Subject: Allow builtin-fetch to work on a detached HEAD X-Git-Tag: v1.5.4-rc0~292^2~45 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b3abdd9d216c578383b66bb10b95edb3380640e7;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-fetch.c b/builtin-fetch.c index 300d5635b..d9272edae 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -151,7 +151,8 @@ static int update_local_ref(struct ref *ref, return 0; } - if (!strcmp(ref->name, current_branch->name) && + if (current_branch && + !strcmp(ref->name, current_branch->name) && !(update_head_ok || is_bare_repository()) && !is_null_sha1(ref->old_sha1)) { /*