diff --git a/apply_pr/fabfile.py b/apply_pr/fabfile.py index 1c82892..f01d2f5 100644 --- a/apply_pr/fabfile.py +++ b/apply_pr/fabfile.py @@ -238,6 +238,11 @@ def apply(diff, stash=True, reject=False, message=None): if stash and stashed: print(colors.yellow('Unstashing...')) sudo("git stash pop") + error_on_pop = sudo("test -f .gitignore && git ls-files -om -X .gitignore || git ls-files -u") + if error_on_pop: + sudo("git reset --merge") + print(colors.red('\U000026D4 Error on stash pop. Keeping stash...')) + raise class GitApplier(object):