summaryrefslogtreecommitdiff
path: root/git-pull.sh
diff options
context:
space:
mode:
authorPhil Hord <hordp@cisco.com>2012-10-23 20:39:56 (GMT)
committerJeff King <peff@peff.net>2012-10-25 09:32:11 (GMT)
commite980765c59c173e9a10ce1069c763645b87fd50c (patch)
tree2307619d5a0395087b2d783b221a06c1edd0955d /git-pull.sh
parent8c7a786b6c8eae8eac91083cdc9a6e337bc133b0 (diff)
downloadgit-e980765c59c173e9a10ce1069c763645b87fd50c.zip
git-e980765c59c173e9a10ce1069c763645b87fd50c.tar.gz
git-e980765c59c173e9a10ce1069c763645b87fd50c.tar.bz2
git-pull: Avoid merge-base on detached head
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. Signed-off-by: Phil Hord <hordp@cisco.com> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'git-pull.sh')
-rwxr-xr-xgit-pull.sh1
1 files changed, 1 insertions, 0 deletions
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")" &&