aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-09-01 07:46:19 +0100
committerGitHub2016-09-01 07:46:19 +0100
commit7b2798cb3509b8c6fb49487b04ec423d287262d0 (patch)
tree4c5932178c5eadeed32f4713fc22856dab98e6b3 /Library
parent5d5b9a78535fbc1f9c31d02991f13120e205f9e8 (diff)
parent46a3003a2f48f9feb595c318446402af35021b83 (diff)
downloadbrew-7b2798cb3509b8c6fb49487b04ec423d287262d0.tar.bz2
Merge pull request #810 from MikeMcQuaid/update-stash-fail
update.sh: reset pre-stash, die if stash fails.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/update.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 7b57bde24..b052631fe 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -226,9 +226,18 @@ merge_or_rebase() {
fi
git merge --abort &>/dev/null
git rebase --abort &>/dev/null
- git -c "user.email=brew-update@localhost" \
- -c "user.name=brew update" \
- stash save --include-untracked "${QUIET_ARGS[@]}"
+ git reset --mixed "${QUIET_ARGS[@]}"
+ if ! git -c "user.email=brew-update@localhost" \
+ -c "user.name=brew update" \
+ stash save --include-untracked "${QUIET_ARGS[@]}"
+ then
+ odie <<EOS
+Could not `git stash` in $DIR!
+Please stash/commit manually if you need to keep your changes or, if not, run:
+ cd $DIR
+ git reset --hard origin/master
+EOS
+ fi
git reset --hard "${QUIET_ARGS[@]}"
STASHED="1"
fi