update.sh: tweak tag handling.
- Don't let the `UPSTREAM_TAG` variable bleed into future repository checks. - Even if the tag branch is an ancestor of the tag ensure that it's forced back to the tag anyway.
This commit is contained in:
parent
09e0b097a4
commit
f9bd121e38
@ -218,6 +218,8 @@ merge_or_rebase() {
|
|||||||
if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
|
if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
|
||||||
then
|
then
|
||||||
UPSTREAM_TAG="$(git tag --list --sort=-version:refname | head -n1)"
|
UPSTREAM_TAG="$(git tag --list --sort=-version:refname | head -n1)"
|
||||||
|
else
|
||||||
|
UPSTREAM_TAG=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$UPSTREAM_TAG" ]
|
if [ -n "$UPSTREAM_TAG" ]
|
||||||
@ -253,7 +255,8 @@ EOS
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
|
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
|
then
|
||||||
|
|
||||||
if [[ -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
|
if [[ -z "$HOMEBREW_NO_UPDATE_CLEANUP" ]]
|
||||||
@ -265,7 +268,8 @@ EOS
|
|||||||
|
|
||||||
# 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" "$REMOTE_REF" &>/dev/null
|
if [[ -z "$UPSTREAM_TAG" ]] &&
|
||||||
|
git merge-base --is-ancestor "$UPSTREAM_BRANCH" "$REMOTE_REF" &>/dev/null
|
||||||
then
|
then
|
||||||
git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
|
git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user