test: clear inherited GIT_* env once per test file so real-Git suites cannot write into an outer repo (#35859)

* test: clear inherited GIT_* env once per test file so real-Git suites cannot write into an outer repo

* test: clear only repo-locating Git env so the compat lane keeps GIT_EXEC_PATH
This commit is contained in:
Neil
2026-10-29 02:40:33 -07:00
committed by GitHub
parent 999d5990ee
commit a50b9964a1
3 changed files with 16 additions and 0 deletions
+1
View File
@@ -19,6 +19,7 @@ export const UNIT_SETUP_FILES = [
'config/scripts/vitest-dom-setup.ts',
'config/scripts/vitest-host-ports-setup.ts',
'config/scripts/vitest-caller-identity-env-setup.ts',
'config/scripts/vitest-inherited-git-env-setup.ts',
'config/scripts/vitest-orcad-feature-readiness-reset.ts'
]
@@ -0,0 +1,14 @@
// A hook's repo-locating Git env would aim real-Git suites at the outer repo; keep GIT_EXEC_PATH and config, which the compat lane sets.
for (const name of [
'GIT_DIR',
'GIT_WORK_TREE',
'GIT_INDEX_FILE',
'GIT_COMMON_DIR',
'GIT_OBJECT_DIRECTORY',
'GIT_ALTERNATE_OBJECT_DIRECTORIES',
'GIT_NAMESPACE',
'GIT_PREFIX',
'GIT_QUARANTINE_PATH'
]) {
delete process.env[name]
}
+1
View File
@@ -6,6 +6,7 @@
"./build-plugins/**/*",
"./scripts/vitest-host-ports-setup.ts",
"./scripts/vitest-caller-identity-env-setup.ts",
"./scripts/vitest-inherited-git-env-setup.ts",
"./scripts/vitest-real-agent-home-write-guard.ts",
"./scripts/vitest-bun-node-builtins.ts",
"./scripts/vitest-dom-setup.ts",