Skip to content

Commit

Permalink
Merge pull request #1060 from MikeMcQuaid/update-tag-tweaks
Browse files Browse the repository at this point in the history
update.sh: tweak tag handling.
  • Loading branch information
MikeMcQuaid authored Sep 21, 2016
2 parents 09e0b09 + f9bd121 commit a381b59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ merge_or_rebase() {
if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
then
UPSTREAM_TAG="$(git tag --list --sort=-version:refname | head -n1)"
else
UPSTREAM_TAG=""
fi

if [ -n "$UPSTREAM_TAG" ]
Expand Down Expand Up @@ -253,7 +255,8 @@ EOS
fi

INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]]
if [[ -n "$UPSTREAM_TAG" ]] ||
[[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]]
then

if [[ -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
Expand All @@ -265,7 +268,8 @@ EOS

# 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" "$REMOTE_REF" &>/dev/null
if [[ -z "$UPSTREAM_TAG" ]] &&
git merge-base --is-ancestor "$UPSTREAM_BRANCH" "$REMOTE_REF" &>/dev/null
then
git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
else
Expand Down

0 comments on commit a381b59

Please sign in to comment.