Warn when changing branch on update

Closes #877
This commit is contained in:
Alyssa Ross 2016-09-05 11:20:19 +01:00
parent 2498d99a14
commit 07a00c234c

View File

@ -242,6 +242,15 @@ EOS
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 [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]]
then then
if [[ -z "$HOMEBREW_DEVELOPER" ]]
then
opoo <<EOS
Checking out $UPSTREAM_BRANCH.
Set HOMEBREW_DEVELOPER=1 to preserve branch when updating Homebrew.
EOS
fi
# 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