git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] git-pull: Avoid merge-base on detached head
@ 2012-10-22 22:50 Phil Hord
  0 siblings, 0 replies; only message in thread
From: Phil Hord @ 2012-10-22 22:50 UTC (permalink / raw)
  To: git
  Cc: gitster, phil.hord, santi, Elijah Newren, Johannes Schindelin,
	Phil Hord

git pull --rebase does some clever tricks to find the base
for $upstream , but it forgets that we may not have any
branch at all.  When this happens, git merge-base reports its
"usage" help in the middle of an otherwise successful
rebase operation, because git-merge is called with one too
few parameters.

Since we do not need the merge-base trick in the case of a
detached HEAD, detect this condition and bypass the clever
trick and the usage noise.
---
 git-pull.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-pull.sh b/git-pull.sh
index 2a10047..266e682 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -200,6 +200,7 @@ test true = "$rebase" && {
 		require_clean_work_tree "pull with rebase" "Please commit or stash them."
 	fi
 	oldremoteref= &&
+	test -n "$curr_branch" &&
 	. git-parse-remote &&
 	remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
 	oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
-- 
1.8.0.2.ge1a3bdd

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

only message in thread, other threads:[~2012-10-22 23:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 22:50 [PATCH 1/2] git-pull: Avoid merge-base on detached head Phil Hord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).