Re: [PATCH 3/3] stash: require a clean index to apply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm writing about the patch that Jeff King submitted on April 22, in <20150422193101.GC27945@xxxxxxxx>, in particular, https://github.com/git/git/commit/ed178ef13a26136d86ff4e33bb7b1afb5033f908 . It appears that this patch was included in git 2.4.2, and it breaks my workflow.

In particular, I have a pre-commit hook whith does the following:

1. Stash unstaged changes ("git stash -k").
2. Run flake8 over all staged changes.
3. If flake8 complains, then error out of the commit.
4. Otherwise, apply the stash and exit.

This way I am prevented from committing staged changes that don't pass flake8. I can't imagine that this is a terribly uncommon workflow.

This worked fine until the aforementioned comment, after which my hook complains, "Cannot apply stash: Your index contains uncommitted changes."

The reason I have to do things this way is as follows. Suppose I did the following:

1. Stage changes that have a flake8 violation.
2. Fix the flake8 violation in the unstaged version of the staged file.
3. Commit the previously staged changes.

If my commit hook runs over the unstaged version of the file, then it won't detect the flake8 violation, and as a result the violation will be committed.

If anyone has a suggestion for how I can achieve the desired goal within the constraints of the 2.4.2 version of git-stash.sh, I'd love to hear it. Otherwise, I'd like to ask for this patch to be reconsidered.

Thank you,

Jonathan Kamens

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]