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)