Skip to content

Conversation

@domodwyer
Copy link
Contributor

@domodwyer domodwyer commented Apr 29, 2020

pass through an environment variable to prevent hooks running

Fixes #1418.

@domodwyer
Copy link
Contributor Author

Running git checkout-index --all --force is not equivalent, so changed to using the env var to skip hooks triggered by the git checkout call.

@domodwyer
Copy link
Contributor Author

I've pushed the changes - I started adding a test case for this, but it's a bit beyond my python skill level I'm afraid.

@asottile
Copy link
Member

needs a test as well

@domodwyer
Copy link
Contributor Author

needs a test as well

As I said, I'm trying to help without really knowing python - the tests are particularly hard to pick apart.

@asottile
Copy link
Member

oh ok, I can help wiht the test

@asottile asottile changed the title staged-files: use git checkout-index fix pre-commit firing during staged_files_only May 2, 2020
@asottile asottile changed the title fix pre-commit firing during staged_files_only fix hooks firing during staged_files_only May 2, 2020
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a test! thanks again!

@asottile asottile merged commit df01824 into pre-commit:master May 2, 2020
@domodwyer
Copy link
Contributor Author

Great cat, thanks for your help!

@asottile
Copy link
Member

thanks again for the fix and report, this has been released as part of v2.4.0 🎉

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

post-checkout hook prevents pre-commit hooks from working with unstaged files

2 participants