fix(hooks): resolve hook dir via git --git-path hooks#355
fix(hooks): resolve hook dir via git --git-path hooks#355squishykid merged 2 commits intoentireio:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes git hook installation to properly respect Git's actual hooks directory configuration. The fix resolves two critical issues where Entire CLI hooks were not being triggered: in linked worktrees (issue #354) and when core.hooksPath is configured (issue #228, commonly seen with Husky).
Changes:
- Replaced hardcoded
.git/hookspath with dynamic resolution viagit rev-parse --git-path hooks - Added
GetHooksDir()andgetHooksDirInPath()functions for hooks directory resolution - Updated hook installation, removal, and detection logic to use the resolved hooks directory
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/entire/cli/strategy/hooks.go | Core implementation: added hooks directory resolution functions and updated all hook operations to use the resolved path instead of hardcoded .git/hooks |
| cmd/entire/cli/strategy/hooks_test.go | Comprehensive test coverage for regular repos, linked worktrees, relative/absolute core.hooksPath, and Husky-style configurations |
squishykid
left a comment
There was a problem hiding this comment.
looks good!
for husky specifically it seems like we need to do a bit more work, so I am going to remove the reference to #228
|
specifically for husky, claude tells me: Because husky points the git hooks to |
This fixes git hook installation/detection/removal to use Git's effective hooks path instead of assuming
$(git rev-parse --git-dir)/hooks.What changed
git rev-parse --git-path hookscore.hooksPath(including Husky-style.husky/_)Validation
go test ./cmd/entire/cli/strategy -count=1go test ./... -count=1Closes #354
Related to #228