From 48753e9b80430e77bd8aaa48a18a63e217afdd8c Mon Sep 17 00:00:00 2001 From: kert Date: Sun, 25 Oct 2026 13:08:00 -0400 Subject: [PATCH] fix(tests): deploy-range git helper ignores the hook's GIT_DIR/GIT_INDEX_FILE The pre-commit hook runs the dev tests with GIT_DIR and GIT_INDEX_FILE set to the real repo; the temp-repo helper inherited them, so every commit that touched dev/ failed at 'git checkout -b feature' (exit 128) while the same test passed from a plain shell. --- tests/dev/test_gen_config_deploy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/dev/test_gen_config_deploy.py b/tests/dev/test_gen_config_deploy.py index 99b656e..cae807c 100644 --- a/tests/dev/test_gen_config_deploy.py +++ b/tests/dev/test_gen_config_deploy.py @@ -105,8 +105,11 @@ def test_image_jobs_gate_on_changes_outputs_not_head_commit(): def _git(*args: str, cwd: Path) -> str: + # Drop GIT_DIR / GIT_INDEX_FILE / GIT_WORK_TREE: the pre-commit hook runs + # this file with them pointing at the real repo, which would redirect + # every call away from the temp repo under `cwd`. env = { - **os.environ, + **{k: v for k, v in os.environ.items() if not k.startswith("GIT_")}, "GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "t@example.invalid", "GIT_COMMITTER_NAME": "t",