{"thread":{"id":"31909","subject":"[PATCH 1/2] git-pull: Avoid merge-base on detached head","startedAt":"2012-10-22T22:50:04Z","lastAt":"2012-10-22T22:50:04Z","messageCount":1,"participants":["Phil Hord"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"201713","messageId":"1350946204-26399-1-git-send-email-hordp@cisco.com","threadId":"31909","inReplyTo":null,"subject":"[PATCH 1/2] git-pull: Avoid merge-base on detached head","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-22T22:50:04Z","receivedAt":"2012-10-22T22:50:04Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"git pull --rebase does some clever tricks to find the base\nfor $upstream , but it forgets that we may not have any\nbranch at all.  When this happens, git merge-base reports its\n\"usage\" help in the middle of an otherwise successful\nrebase operation, because git-merge is called with one too\nfew parameters.\n\nSince we do not need the merge-base trick in the case of a\ndetached HEAD, detect this condition and bypass the clever\ntrick and the usage noise.\n---\n git-pull.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 2a10047..266e682 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -200,6 +200,7 @@ test true = \"$rebase\" && {\n \t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n \tfi\n \toldremoteref= &&\n+\ttest -n \"$curr_branch\" &&\n \t. git-parse-remote &&\n \tremoteref=\"$(get_remote_merge_branch \"$@\" 2>/dev/null)\" &&\n \toldremoteref=\"$(git rev-parse -q --verify \"$remoteref\")\" &&\n-- \n1.8.0.2.ge1a3bdd\n"}]}