Bug 1242034

Summary: "git stash save -k" followed by "git stash apply" fails
Product: [Fedora] Fedora Reporter: Jonathan Kamens <h1k6zn2m>
Component: gitAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: chrisw, jbowes, pstodulk, tmz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: git-2.4.3-6.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-21 08:13:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Kamens 2015-07-10 18:08:41 UTC
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." 

This bug was introduced into git in this commit: https://github.com/git/git/commit/ed178ef13a26136d86ff4e33bb7b1afb5033f908

It was reverted in a subsequent commit: https://github.com/git/git/commit/19376104a8251a7e6c56579cdcd2eb0a106d1fd6

The revert will probably be in git 2.4.6 (it's on the 2.4.x branch), but in the meantime, git is broken for me, so I am wondering if we can apply the revert as a patch to git 2.4.3 in F22.

Comment 1 Jonathan Kamens 2015-07-15 22:06:01 UTC
FYI, the revert I'm asking you to pull in is indeed included in git 2.4.6.

Comment 2 Fedora Update System 2015-07-16 18:13:30 UTC
git-2.4.3-6.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/git-2.4.3-6.fc22

Comment 3 Fedora Update System 2015-07-18 02:08:44 UTC
Package git-2.4.3-6.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing git-2.4.3-6.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11781/git-2.4.3-6.fc22
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2015-07-21 08:13:14 UTC
git-2.4.3-6.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.