$ cd /tmp/wt-66 && npx vitest run test/hooks.test.ts
FAIL test/hooks.test.ts
Error: ENOTDIR: not a directory, scandir '/private/tmp/wt-66/.git/hooks'
❯ snapshotOwnHooks test/hooks.test.ts:136
In a linked worktree .git is a file containing gitdir: /path/to/real, not a directory. snapshotOwnHooks reads <root>/.git/hooks directly and the whole file fails to collect — so its ~48 tests silently vanish from the count.
Why it matters beyond the error
The suite reports 1147 passed in a worktree against ~1195 on the main checkout. A lower number with no failure attributed to the missing file is exactly the shape that produced a false "943 against a 1108 baseline" earlier in this project. Anyone verifying a branch in a worktree reads a green-ish result that is missing a file's worth of coverage.
That makes it a verification-integrity defect, not just a portability one.
It is currently blocking real work
Four branches are being developed in worktrees right now (bug-issue-66, -70, -75, feat-issue-52) to avoid the dist/ merge conflicts in #73. Every delegate working in one sees this failure, and any "suite green" report from a worktree is unreliable until it is fixed.
Fix
Resolve the git directory rather than assuming its location:
git rev-parse --git-path hooks
That returns the correct path in a plain checkout, a linked worktree, and a bare repository. Audit the rest of the suite and src/ for other \.git/ string joins — git rev-parse --git-dir / --git-common-dir exist for exactly this and the tool should not be hand-building the path anywhere.
Worth checking whether hooks install, doctor, and the commit-msg hook resolution have the same assumption. If they do, CommitLore does not work in a worktree at all, which is a larger finding than the test failure that surfaced it.
In a linked worktree
.gitis a file containinggitdir: /path/to/real, not a directory.snapshotOwnHooksreads<root>/.git/hooksdirectly and the whole file fails to collect — so its ~48 tests silently vanish from the count.Why it matters beyond the error
The suite reports
1147 passedin a worktree against~1195on the main checkout. A lower number with no failure attributed to the missing file is exactly the shape that produced a false "943 against a 1108 baseline" earlier in this project. Anyone verifying a branch in a worktree reads a green-ish result that is missing a file's worth of coverage.That makes it a verification-integrity defect, not just a portability one.
It is currently blocking real work
Four branches are being developed in worktrees right now (
bug-issue-66,-70,-75,feat-issue-52) to avoid thedist/merge conflicts in #73. Every delegate working in one sees this failure, and any "suite green" report from a worktree is unreliable until it is fixed.Fix
Resolve the git directory rather than assuming its location:
That returns the correct path in a plain checkout, a linked worktree, and a bare repository. Audit the rest of the suite and
src/for other\.git/string joins —git rev-parse --git-dir/--git-common-direxist for exactly this and the tool should not be hand-building the path anywhere.Worth checking whether
hooks install,doctor, and the commit-msg hook resolution have the same assumption. If they do, CommitLore does not work in a worktree at all, which is a larger finding than the test failure that surfaced it.