update-bash: don't stash for --simulate-from-current-branch

When invoking --simulate-from-current-branch, we shouldn't do any file
manipulation.
This commit is contained in:
Xu Cheng 2016-01-21 14:01:51 +08:00
parent f7c276a0be
commit 58e0249609

View File

@ -155,22 +155,6 @@ pull() {
INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
UPSTREAM_BRANCH="$(upstream_branch)"
trap reset_on_interrupt SIGINT
if [[ -n "$(git status --untracked-files=all --porcelain 2>/dev/null)" ]]
then
if [[ -n "$HOMEBREW_VERBOSE" ]]
then
echo "Stashing uncommitted changes to $DIR."
git status --short --untracked-files=all
fi
git -c "user.email=brew-update@localhost" \
-c "user.name=brew update" \
stash save --include-untracked $QUIET_ARGS
git reset --hard $QUIET_ARGS
STASHED="1"
fi
# Used for testing purposes, e.g., for testing formula migration after
# renaming it in the currently checked-out branch. To test run
# "brew update --simulate-from-current-branch"
@ -187,6 +171,22 @@ pull() {
return
fi
trap reset_on_interrupt SIGINT
if [[ -n "$(git status --untracked-files=all --porcelain 2>/dev/null)" ]]
then
if [[ -n "$HOMEBREW_VERBOSE" ]]
then
echo "Stashing uncommitted changes to $DIR."
git status --short --untracked-files=all
fi
git -c "user.email=brew-update@localhost" \
-c "user.name=brew update" \
stash save --include-untracked $QUIET_ARGS
git reset --hard $QUIET_ARGS
STASHED="1"
fi
if [[ "$INITIAL_BRANCH" != "$UPSTREAM_BRANCH" && -n "$INITIAL_BRANCH" ]]
then
# Recreate and check out `#{upstream_branch}` if unable to fast-forward