You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been encountering an issue recently regarding how the pre-commit hook handles stashing.
I use git > 2.0 which has the commit.gpgsign option which with automatically enable GPG signing for most actions that are relevant -- including stashing.
The issue is that if this fails, either it fails to decrypt your key or your escape it, stashing fails, but overcommit doesn't check the exit status for git stash. Overcommit then moves on like it succeeded, leading to it hard reseting your working tree anyway.
Ideally overcommit should be checking to see if any of these actions have non-zero exit codes (or term signals) and aborting.
You're definitely right that overcommit should detect if the git stash fails. We actually just ran into a problem ourselves where if your git author or email were not defined, git stash would fail depending on the version of git you were using, wiping your working tree in the same manner.
Overcommit can't run effectively in this scenario, so I've gone ahead and changed the behavior to fail fast when git stash fails. It will be available in the next release of overcommit, which I'll be releasing by tomorrow.
Activity
sds commentedon Jul 28, 2014
Hey @kevinoconnor7, thanks for the report!
You're definitely right that
overcommitshould detect if thegit stashfails. We actually just ran into a problem ourselves where if your git author or email were not defined,git stashwould fail depending on the version of git you were using, wiping your working tree in the same manner.Overcommit can't run effectively in this scenario, so I've gone ahead and changed the behavior to fail fast when
git stashfails. It will be available in the next release ofovercommit, which I'll be releasing by tomorrow.Support hook side effects without stashing repository changes (#939)