Skip to content

fix(hooks): resolve hook dir via git --git-path hooks#355

Merged
squishykid merged 2 commits intoentireio:mainfrom
AlienKevin:kevin/fix-hooks-git-path-hooks
Feb 16, 2026
Merged

fix(hooks): resolve hook dir via git --git-path hooks#355
squishykid merged 2 commits intoentireio:mainfrom
AlienKevin:kevin/fix-hooks-git-path-hooks

Conversation

@AlienKevin
Copy link
Contributor

@AlienKevin AlienKevin commented Feb 16, 2026

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

  • Resolve hooks dir via git rev-parse --git-path hooks
  • Update hook install/remove/detection to use the resolved hooks dir
  • Add tests for linked worktrees and core.hooksPath (including Husky-style .husky/_)

Validation

  • go test ./cmd/entire/cli/strategy -count=1
  • go test ./... -count=1

Closes #354
Related to #228

Copilot AI review requested due to automatic review settings February 16, 2026 09:52
@AlienKevin AlienKevin requested a review from a team as a code owner February 16, 2026 09:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/hooks path with dynamic resolution via git rev-parse --git-path hooks
  • Added GetHooksDir() and getHooksDirInPath() 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

Copy link
Member

@squishykid squishykid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@squishykid squishykid merged commit 0280559 into entireio:main Feb 16, 2026
3 checks passed
@squishykid
Copy link
Member

specifically for husky, claude tells me:

How Husky v9 actually works:
  - .husky/_/ = internal, managed by Husky (overwritten on install)
  - .husky/<hookname> = user-facing scripts (not overwritten)
  - core.hooksPath points to .husky/_/, and the wrappers there delegate to .husky/<hookname>

Because husky points the git hooks to husky/_/ and the contents of those husky-managed git hooks is always overwritten/managed we have to think about a special case for husky if we want to coexist. We probably need to detect husky and then write into .husky/<hookname>.

@squishykid squishykid mentioned this pull request Feb 16, 2026
12 tasks
@Soph Soph mentioned this pull request Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

entire enable hooks not triggered in linked worktrees

3 participants