-
-
Notifications
You must be signed in to change notification settings - Fork 607
Run git-hooks more correctly #2483
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
Conversation
859aa5a
to
2d90eb5
Compare
Is there any way to write a test for this? |
In GitoxideLabs/gitoxide@51bbb86#diff-b1f4fc8d8a8a51923a922a937745a1f5665443821b5c4df58efa44c7c4515216 there is a check if the file returned by path() exists. But that isn't really a useful test. Maybe there could be some sort of integration test that creates a git-repo with hooks that then runs run_hook. But that wouldn't really help as that would only test one setup and this is about making it work on as many setups as possible. |
we do exactly that in the hooks unittests |
running the tests with |
Why is git only adds |
I think on non-Windows platforms it's best to just execute the hooks directly. I don't see a reason to use a shell. |
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.
Thank you for your effort on this, @Joshix-1.
Generally, all of this is very reasonable.
Not executing bash -l
on linux shaves off 300 ms on my system, too, which is a particularly pleasant aspect of this change! :)
git2-hooks is released separately from gitui, too, so we need to consider this regarding changes in git2-hooks behavior.
Two of the remarks below are just me writing down my thoughts, so that they're mentioned somewhat close to your change, both so why I'd argue that they're correct and so we could potentially refer to them.
This will be fixed in gitui-org#2483
This will be fixed in gitui-org#2483
This will be fixed in gitui-org#2483
This will be fixed in gitui-org#2483
@Joshix-1: Thanks for your work on this. Is this ready for me to have another look? |
I think so |
@Byron this one affects |
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.
Thanks for your work. I realize that there's a TODO, but this correctly returns an error and it's still an improvement over what we had before. Thanks in particular for also taking care about making this work on a platform you're not using.
I also realize that you added broken UTF-8 to the tests. Naively I'd have wagered that this doesn't even work. It obviously does. TIL.
Ah, one more thing: Would you please rebase or resolve conflicts? |
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.
Thanks for calling me in, @extrawurst , and thanks @Joshix-1 for tackling this!
I am very impressed by the attention to detail that went into this PR, it's beyond what I know about git-hooks. For all I know, there isn't much special about how Git executes hooks and gix-command
would be able to capture all subtleties already.
In any case, it's an improvement, and if using gix-path
or gix-command
, that could definitely be addressed in a follow-up PR.
This Pull Request fixes #2482.
It changes the following:
I followed the checklist:
make check
without errorsDidn't test this on Windows