Skip to content

fix: install lefthook hooks via git --git-path hooks#6

Merged
Mayeu merged 1 commit into
mainfrom
fix/lefthook-install-in-worktrees
May 9, 2026
Merged

fix: install lefthook hooks via git --git-path hooks#6
Mayeu merged 1 commit into
mainfrom
fix/lefthook-install-in-worktrees

Conversation

@Mayeu
Copy link
Copy Markdown
Owner

@Mayeu Mayeu commented May 9, 2026

The previous worktree guard skipped hook installation entirely from linked worktrees, leaving them to rely on stale symlinks installed earlier from the main checkout — which broke once those store paths were GC'd.

Per gitrepository-layout(5), git always looks up hooks in the common gitdir, so a single install from any worktree wires up hooks for every worktree. Resolve the hooks dir with git rev-parse --git-path hooks (returns /hooks from any worktree) instead of the literal .git/hooks, which fails in worktrees where .git is a file.

Base automatically changed from fix/entering-the-shell-should-create-dotfile-at-the-root to main May 9, 2026 17:30
The previous worktree guard skipped hook installation entirely from linked
worktrees, leaving them to rely on stale symlinks installed earlier from the
main checkout — which broke once those store paths were GC'd.

Per gitrepository-layout(5), git always looks up hooks in the common gitdir,
so a single install from any worktree wires up hooks for every worktree.
Resolve the hooks dir with `git rev-parse --git-path hooks` (returns
<common-dir>/hooks from any worktree) instead of the literal `.git/hooks`,
which fails in worktrees where `.git` is a file.
@Mayeu Mayeu force-pushed the fix/lefthook-install-in-worktrees branch from e82029a to 8c86f5e Compare May 9, 2026 17:30
@Mayeu Mayeu merged commit f8a026e into main May 9, 2026
2 checks passed
@Mayeu Mayeu deleted the fix/lefthook-install-in-worktrees branch May 9, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant