update: better handle merge conflicts.

When there are merge conflicts we fail pretty hard. This is still
possible after this commit but at least we've given Git enough pointers
to make it less likely.

Closes Homebrew/homebrew#49299.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Mike McQuaid 2016-02-18 10:38:30 +00:00
parent cc3e2e8f0f
commit 3505509bae

View File

@ -203,6 +203,7 @@ pull() {
echo "Stashing uncommitted changes to $DIR."
git status --short --untracked-files=all
fi
git merge --abort &>/dev/null
git -c "user.email=brew-update@localhost" \
-c "user.name=brew update" \
stash save --include-untracked "${QUIET_ARGS[@]}"
@ -232,7 +233,10 @@ pull() {
then
git rebase "${QUIET_ARGS[@]}" "origin/$UPSTREAM_BRANCH"
else
git merge --no-edit --ff "${QUIET_ARGS[@]}" "origin/$UPSTREAM_BRANCH"
git merge --no-edit --ff "${QUIET_ARGS[@]}" "origin/$UPSTREAM_BRANCH" \
--strategy=recursive \
--strategy-option=ours \
--strategy-option=ignore-all-space
fi
export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$(read_current_revision)"