While validating #2965 from a local worktree, the real pre-push hook passes Git repository-local environment variables into pytest. GIT_DIR points to the originating worktree and GIT_CONFIG_PARAMETERS can carry its hook override. Tests that create temporary repositories then fail during setup or run the wrong hooks; the same test files pass outside the hook.
Required fix: clear Git's repository-local environment before launching the pre-push validation commands, while retaining the real hooks and all validation gates. Add regression coverage proving temporary repositories remain independent under a worktree-style hook environment.
Discovered while fixing #2965; resolving this is needed to complete the local push validation for that issue.
While validating #2965 from a local worktree, the real pre-push hook passes Git repository-local environment variables into pytest.
GIT_DIRpoints to the originating worktree andGIT_CONFIG_PARAMETERScan carry its hook override. Tests that create temporary repositories then fail during setup or run the wrong hooks; the same test files pass outside the hook.Required fix: clear Git's repository-local environment before launching the pre-push validation commands, while retaining the real hooks and all validation gates. Add regression coverage proving temporary repositories remain independent under a worktree-style hook environment.
Discovered while fixing #2965; resolving this is needed to complete the local push validation for that issue.