git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Kamens <jkamens@quantopian.com>
To: git@vger.kernel.org
Subject: Re: [PATCH 3/3] stash: require a clean index to apply
Date: Thu, 4 Jun 2015 20:43:00 -0400	[thread overview]
Message-ID: <5570F094.10007@quantopian.com> (raw)

I'm writing about the patch that Jeff King submitted on April 22, in 
<20150422193101.GC27945@peff.net>, 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

             reply	other threads:[~2015-06-05  0:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05  0:43 Jonathan Kamens [this message]
2015-06-07 12:40 ` [PATCH 3/3] stash: require a clean index to apply Jeff King
2015-06-07 12:47   ` Jeff King
2015-06-10 18:19   ` bär
2015-06-10 18:56     ` Jeff King
2015-06-10 19:16       ` Junio C Hamano
2015-06-10 19:27         ` Jeff King
2015-06-10 21:54           ` bär
2015-06-15 17:42           ` Junio C Hamano
2015-06-15 18:27             ` [PATCH] Revert "stash: require a clean index to apply" Jeff King
2015-06-15 20:11               ` Junio C Hamano
2015-06-25 21:51                 ` Jonathan Kamens
     [not found]                 ` <f06e573d-02e3-47e9-85d8-3bb6551d72f5.maildroid@localhost>
2015-06-26  0:27                   ` Jeff King
2015-06-26  1:12                     ` Jonathan Kamens
2015-06-26  4:03                       ` Jeff King
2015-06-26  4:15                         ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2015-04-22 19:29 How do I resolve conflict after popping stash without adding the file to index? Jeff King
2015-04-22 19:31 ` [PATCH 3/3] stash: require a clean index to apply Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5570F094.10007@quantopian.com \
    --to=jkamens@quantopian.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).