Revert "update: checkout branch unconditionally"

This reverts commit 0525c9eeea27eff1a6de05e7a01ec268ae07437b.
Which breaks `brew update --rebase`.
This commit is contained in:
Xu Cheng 2016-03-09 17:35:03 +08:00
parent ec2a3f979e
commit 865b788e96

View File

@ -211,6 +211,8 @@ pull() {
STASHED="1" STASHED="1"
fi fi
if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]]
then
# Recreate and check out `#{upstream_branch}` if unable to fast-forward # Recreate and check out `#{upstream_branch}` if unable to fast-forward
# it to `origin/#{@upstream_branch}`. Otherwise, just check it out. # it to `origin/#{@upstream_branch}`. Otherwise, just check it out.
if git merge-base --is-ancestor "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" &>/dev/null if git merge-base --is-ancestor "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" &>/dev/null
@ -219,6 +221,7 @@ pull() {
else else
git checkout --force -B "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}" git checkout --force -B "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
fi fi
fi
INITIAL_REVISION="$(read_current_revision)" INITIAL_REVISION="$(read_current_revision)"
export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION" export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION"