amaechler opened a new pull request, #20477: URL: https://github.com/apache/druid/pull/20477
The git hooks don't work from a linked git worktree. There, `.git` is a file (`gitdir: .../.git/worktrees/<name>`), not a directory, so the hooks' relative `.git/hooks/...` paths fail and block every commit and push. `install-hooks.sh` and `uninstall-hooks.sh` fail the same way. With many agents working in worktrees by default, this is a much more common scneario nowadays (my local Claude basically just always passes `--no-verify` to skip the hooks). Before: ```sh $ git worktree add ../druid-wt -b feature && cd ../druid-wt $ git commit -m test .git/hooks/pre-commit: line 18: .git/hooks/run-all-in-dir.py: Not a directory $ hooks/install-hooks.sh . mkdir: ./.git: Not a directory ``` After: ``` $ git commit -m test [feature 293a5b3] test ``` This picks up #17706 without the `eval`: - `pre-commit` and `pre-push` find their helper files next to themselves via `$0`, which git sets to the hook's own path. This needs no git call and also works when `core.hooksPath` is set. - `install-hooks.sh` and `uninstall-hooks.sh` find the hooks folder with `git rev-parse --git-common-dir` instead of assuming `.git/hooks`. This needs git 2.31 or newer. - Paths are quoted, and `pre-push` forwards `"$@"`. If you already have the hooks installed, the installer won't overwrite them. To pick up the fix, delete `.git/hooks/pre-commit` and `.git/hooks/pre-push`, then run `hooks/uninstall-hooks.sh .` and `hooks/install-hooks.sh .`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
