Skip to content

Wipes working changes if git stash fails #65

Closed

Description

@kevinoconnor7

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.

Activity

  1. sds commented on Jul 28, 2014

    @sds
    Owner

    Hey @kevinoconnor7, thanks for the report!

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions