aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/update.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index acf4520ba..570a4c36b 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -215,7 +215,18 @@ merge_or_rebase() {
trap reset_on_interrupt SIGINT
- REMOTE_REF="origin/$UPSTREAM_BRANCH"
+ if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
+ then
+ UPSTREAM_TAG="$(git tag --list --sort=-version:refname | head -n1)"
+ fi
+
+ if [ -n "$UPSTREAM_TAG" ]
+ then
+ REMOTE_REF="refs/tags/$UPSTREAM_TAG"
+ UPSTREAM_BRANCH="v$UPSTREAM_TAG"
+ else
+ REMOTE_REF="origin/$UPSTREAM_BRANCH"
+ fi
if [[ -n "$(git status --untracked-files=all --porcelain 2>/dev/null)" ]]
then