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.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user