From 58e02496090d45af7c95ad901a8e004620063b28 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 21 Jan 2016 14:01:51 +0800 Subject: [PATCH] update-bash: don't stash for --simulate-from-current-branch When invoking --simulate-from-current-branch, we shouldn't do any file manipulation. --- Library/Homebrew/cmd/update-bash.sh | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Library/Homebrew/cmd/update-bash.sh b/Library/Homebrew/cmd/update-bash.sh index 856ac1e5c0..e72f3f196e 100755 --- a/Library/Homebrew/cmd/update-bash.sh +++ b/Library/Homebrew/cmd/update-bash.sh @@ -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