update-report: cleanup git harder in migration.

Before stashing also try to cancel any current merge, rebase and
reset. This will prevent any data loss but also make the stash more
likely to succeed.
This commit is contained in:
Mike McQuaid 2016-09-18 20:25:18 +01:00
parent 027d8923f2
commit 42e9782dd6

View File

@ -208,6 +208,9 @@ module Homebrew
unless Utils.popen_read("git status --untracked-files=all --porcelain").empty?
HOMEBREW_REPOSITORY.cd do
quiet_system "git", "merge", "--abort"
quiet_system "git", "rebase", "--abort"
quiet_system "git", "reset", "--mixed"
safe_system "git", "-c", "user.email=brew-update@localhost",
"-c", "user.name=brew update",
"stash", "save", "--include-untracked"