Current Behavior
The pre-commit, pre-push hooks and perf-validate command hardcode .git/perf-attestation.json and .git/hooks/ paths. In a git worktree, .git is a file (pointer to the real git dir), not a directory. This causes:
cargo xtask perf-validate fails to write attestation: Not a directory (os error 20)
- Pre-push hook can't find the attestation and blocks the push
cargo xtask install-hooks would fail in a worktree
Expected Behavior
Hooks and attestation should work correctly in both normal repos and git worktrees.
Technical Details
Relevant Code
xtask/src/hooks.rs:54,85,118 and xtask/src/perf_validate.rs:246
All use root.join(".git/...") which assumes .git is a directory.
Root Cause
In a git worktree, .git is a file containing gitdir: /path/to/real/.git/worktrees/<name>. The fix is to use git rev-parse --git-dir which returns the correct directory in both contexts.
Current Behavior
The pre-commit, pre-push hooks and
perf-validatecommand hardcode.git/perf-attestation.jsonand.git/hooks/paths. In a git worktree,.gitis a file (pointer to the real git dir), not a directory. This causes:cargo xtask perf-validatefails to write attestation:Not a directory (os error 20)cargo xtask install-hookswould fail in a worktreeExpected Behavior
Hooks and attestation should work correctly in both normal repos and git worktrees.
Technical Details
Relevant Code
xtask/src/hooks.rs:54,85,118andxtask/src/perf_validate.rs:246All use
root.join(".git/...")which assumes.gitis a directory.Root Cause
In a git worktree,
.gitis a file containinggitdir: /path/to/real/.git/worktrees/<name>. The fix is to usegit rev-parse --git-dirwhich returns the correct directory in both contexts.