prati0100 / git-gui

Tcl/Tk based UI for Git. I am currently acting as the project's maintainer.
160 stars 87 forks source link

Does not respect core.hooksPath #62

Open ukch opened 2 years ago

ukch commented 2 years ago

Tools such as Husky work by storing pre-commit and other git hooks in their own directory (in this case, .husky) and by setting core.hooksPath in the config to point to that directory instead of the default .git/hooks. This tool, however, does not see those hooks and it is possible to accidentally bypass git hooks by using git-gui.

To reproduce:

Workaround:

Naddiseo commented 2 years ago

I did a little investigation as to how git gui calls git hooks, and it looks like it doesn't use git itself; but instead builds the builds the path to the hook file by joining gitdir, "hooks", and "hook_name". I believe to fix this bug, the githook_read in "./git-gui.sh would need to be modified to first read if core.hooksPath is set. I don't know TCL at all otherwise I'd open a PR to read the config first.

I think allowing git gui to read core.hooksPath would also fix: https://github.com/typicode/husky/issues/1041

piranna commented 1 year ago

Any update on this? It seems to be a pretty simple fix...

rimrul commented 9 months ago

There has been a patch submission to the git mailing list that should fix this.

https://lore.kernel.org/git/20230917192431.101775-1-mlevedahl@gmail.com/T/#u