Re: [PATCH 3/3] stash: require a clean index to apply
- From
Jeff King <peff@peff.net>
- Date
- Jun 7, 2015, 12:47 UTC
- Message-ID
- <20150607124714.GA17632@peff.net>
- In-Reply-To
- <20150607124001.GA11042@peff.net>
On Sun, Jun 07, 2015 at 08:40:01AM -0400, Jeff King wrote:
Show 7 quoted lines
> Are you running flake8 across the whole tree, or just on the files with > proposed changes? Does it need to see the whole tree? If you can get > away with feeding it single files, then it should be very efficient to > loop over the output of "git diff-index HEAD" and feed the proposed > updated blobs to it. If you can get away with feeding single lines, then > feeding the actual diffs to it would be even better, but I assume that > is not enough (I do not use flake8 myself).
Like I said, I do not use it, but peeking at the flake8 source code, it has an "--install-hook" option to set up a pre-commit hook. It looks like the hook runs "git diff-index --cached --name-only HEAD" to get the list of modified files, filters that only for "*.py", and then copies the results into a temporary directory to operate on.
-Peff