-
-
Notifications
You must be signed in to change notification settings - Fork 236
Insure git hooks are ignored on checkout during conflicts #2432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Insure git hooks are ignored on checkout during conflicts #2432
Conversation
|
Can you explain your setup in more details please? Are you using pre-commit, the tool? Why does it prevent a |
Yes
It's similar to a test. I have hooks enabled for post-checkout (In the action project, it's a hook for poetry to sync deps). So it gets triggered by git checkout, but during sync, |
|
OK, thanks. Could you try to see if |
Yes it triggers it |
|
Thanks! I have to say I find it dumb though 🫠 Because clearly the intent here is to undo modifications in a file unrelated to pre-commit, not checking out another branch. Erm, ChatGPT says:
https://git-scm.com/docs/githooks
Maybe there's a way to check the flag on your side and do nothing when it's equal to 0 (file retrieved from index)? And/or when the old ref and new ref are the same. I wonder if #2376 wouldn't fix this too. But we might want to merge this as a quickfix in the meantime. It's crazy how many things can get in the way when running Git operations programmatically 😄 |
|
I wonder, is it generally valid to ignore post-checkout hooks? AFAIK, for example Git LFS' smudge filter runs after checkout to resolve the LFS pointers and fetch the actual blobs from the LFS server. Not 100% sure whether that's relevant in this case though. |
Issues arise when you have post-checkout hooks, and you have conflicts, and also updated
.pre-commit-hooks.yamlfile