aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-03-08 19:13:38 +0800
committerXu Cheng2016-03-08 20:36:19 +0800
commit3a4f2c1aeaa65527ff7d10684db9d262f1892de5 (patch)
tree4d7b2160ff039e2e82f30486fd3588d57677b6ae /Library
parentcad2a5620fbd847bca78c6b17ea97c877224b724 (diff)
downloadbrew-3a4f2c1aeaa65527ff7d10684db9d262f1892de5.tar.bz2
update: checkout branch unconditionally
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/update.sh15
1 files changed, 6 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 07847a0ba..0c2faf448 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -211,16 +211,13 @@ pull() {
STASHED="1"
fi
- if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]]
+ # Recreate and check out `#{upstream_branch}` if unable to fast-forward
+ # it to `origin/#{@upstream_branch}`. Otherwise, just check it out.
+ if git merge-base --is-ancestor "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" &>/dev/null
then
- # Recreate and check out `#{upstream_branch}` if unable to fast-forward
- # it to `origin/#{@upstream_branch}`. Otherwise, just check it out.
- if git merge-base --is-ancestor "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" &>/dev/null
- then
- git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
- else
- git checkout --force -B "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
- fi
+ git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
+ else
+ git checkout --force -B "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
fi
INITIAL_REVISION="$(read_current_revision)"