From 6a03ed499090afa2bfb026ae73629de2272a80e2 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Thu, 29 Oct 2026 01:51:14 -0700 Subject: [PATCH] test(runtime): keep inherited GIT_* env from aiming worktree-removal tests at an outer repo (#35853) --- .../runtime/runtime-failed-local-worktree-removal.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/runtime/runtime-failed-local-worktree-removal.test.ts b/src/main/runtime/runtime-failed-local-worktree-removal.test.ts index c2af302ca3a..0d8d12fe198 100644 --- a/src/main/runtime/runtime-failed-local-worktree-removal.test.ts +++ b/src/main/runtime/runtime-failed-local-worktree-removal.test.ts @@ -201,6 +201,10 @@ async function failInSession(): Promise { describe.skipIf(process.platform !== 'darwin')('a worktree delete Git fails partway', () => { beforeEach(async () => { + // A git hook's GIT_DIR/GIT_INDEX_FILE would point the scratch repo's git, and Orca's, at the outer repo. + for (const key of Object.keys(process.env).filter((name) => name.startsWith('GIT_'))) { + vi.stubEnv(key, undefined) + } vi.spyOn(console, 'warn').mockImplementation(() => {}) scratchDir = await realpath(await mkdtemp(join(tmpdir(), 'orca-failed-removal-'))) recordsDir = join(scratchDir, 'profile') @@ -228,6 +232,7 @@ describe.skipIf(process.platform !== 'darwin')('a worktree delete Git fails part _resetPendingWorktreeRemovalsForTests() vi.mocked(removeHostTree).mockClear() vi.restoreAllMocks() + vi.unstubAllEnvs() await setImmutable(false, scratchDir) expect((await execFileAsync('find', [scratchDir, '-flags', '+uchg'])).stdout).toBe('') await removeTree(scratchDir)