Skip to content

entire enable hooks not triggered in linked worktrees #354

@AlienKevin

Description

@AlienKevin

What happened?

In a linked git worktree, entire enable installs git hooks under:
$(git rev-parse --git-dir)/hooks

But Git executes hooks from:
$(git rev-parse --git-path hooks)

So prepare-commit-msg (and other Entire-managed hooks) are not triggered in linked worktrees.

Observed behavior in repro:

  • wrong_hook exists: yes
  • active_hook exists: no
  • commit succeeds, but hook tracer log is empty (hook never ran)

Expected behavior:

  • Entire should install hooks in the active hooks directory from git rev-parse --git-path hooks (and respect core.hooksPath), so hooks run during commit in linked worktrees.

Related issues:

Steps to reproduce

set -euo pipefail

ENTIRE_BIN="entire"
tmp="$(mktemp -d)"
log="$tmp/hook.log"

git init "$tmp/repo" >/dev/null
cd "$tmp/repo"
git config user.email [email protected]
git config user.name tester
echo init > f.txt
git add f.txt
git commit -m init >/dev/null

git worktree add "$tmp/wt" -b feat >/dev/null
cd "$tmp/wt"

"$ENTIRE_BIN" enable --agent claude-code --telemetry=false >/dev/null

git_dir="$(git rev-parse --git-dir)"
active_hooks="$(git rev-parse --git-path hooks)"
wrong_hook="$git_dir/hooks/prepare-commit-msg"
active_hook="$active_hooks/prepare-commit-msg"

echo "git-dir:      $git_dir"
echo "active hooks: $active_hooks"
echo "wrong_hook exists: $([ -f "$wrong_hook" ] && echo yes || echo no)"
echo "active_hook exists: $([ -f "$active_hook" ] && echo yes || echo no)"

# tracer: append line to whichever Entire hook exists
for hook in "$wrong_hook" "$active_hook"; do
  if [ -f "$hook" ] && grep -q "Entire CLI hooks" "$hook"; then
    printf '\necho "HOOK_RAN_FROM: %s" >> "%s"\n' "$hook" "$log" >> "$hook"
    chmod +x "$hook"
  fi
done

: > "$log"
echo change >> f.txt
git add f.txt
git commit -m "repro" >/dev/null

echo "hook log content:"
cat "$log" || true

Entire CLI version

Entire CLI 0.4.4 (2f0ad9a)

OS and architecture

Darwin 25.2.0 arm64

Agent

Claude Code

Strategy

manual-commit (default)

Terminal

No response

Logs / debug output

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions