You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Start a new npm project (npm init) inside a git repo
Install husky (npm install husky)
Run npx husky add pre-commit false && npx husky install - this creates a .husky/pre-commit hook which will always fail
Attempt to commit using the command line: the pre-commit hook fails and the commit aborts
Attempt to commit using git gui: the pre-commit hook is not run
Workaround:
Symlink .husky to .git/hooks
The text was updated successfully, but these errors were encountered:
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: typicode/husky#1041
Tools such as Husky work by storing pre-commit and other git hooks in their own directory (in this case,
.husky
) and by settingcore.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:
npm init
) inside a git reponpm install husky
)npx husky add pre-commit false && npx husky install
- this creates a.husky/pre-commit
hook which will always failgit gui
: the pre-commit hook is not runWorkaround:
.husky
to.git/hooks
The text was updated successfully, but these errors were encountered: