All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Allow builtin-fetch to work on a detached HEAD
@ 2007-09-16  6:31 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2007-09-16  6:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 builtin-fetch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index 300d563..d9272ed 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)) {
 		/*
-- 
1.5.3.1.1000.g7319b

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-16  6:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-16  6:31 [PATCH 1/3] Allow builtin-fetch to work on a detached HEAD Shawn O. Pearce

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.