Found during the #2 fix build (PR #13). git commit exports GIT_DIR, GIT_INDEX_FILE (and sometimes GIT_WORK_TREE) to hook children. .githooks/pre-commit runs the FULL pytest suite inside the hook, so any test that shells out to git (fixture-repo tests do) inherits those vars and operates on the REAL repository instead of its tmp fixture dir.
Observed effects in a worktree: HEAD reset, index truncated to a single entry, stray init/base fixture commits landing on real refs, and core.bare true written into the primary repo's config.
Fix: unset the inherited env at the top of the hook before invoking pytest:
unset GIT_DIR GIT_INDEX_FILE GIT_WORK_TREE GIT_INDEX_VERSIONBelt-and-braces alternative/addition: make fixture tests that spawn git pass env={...} scrubbed of GIT_*, so the suite is safe under ANY caller, not just this hook.
🤖 Generated with Claude Code
Activity
0No activity yet.