-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
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. |
sisp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if #2376 wouldn't fix this too.
@pawamoy I imagine a similar problem would occur because there's also a git checkout call.
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.
I've read up on Git LFS, it uses a post-checkout hook for making locked files read-only in the working copy; this is probably irrelevant in our case. But I still wonder a bit about the general validity of ignoring all hooks here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2432 +/- ##
==========================================
- Coverage 97.26% 97.18% -0.08%
==========================================
Files 55 55
Lines 6288 6405 +117
==========================================
+ Hits 6116 6225 +109
- Misses 172 180 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sisp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉 Thanks for your contribution and patience with my recurring review suggestions. 🙇
Issues arise when you have post-checkout hooks, and you have conflicts, and also updated
.pre-commit-hooks.yamlfile