fix(worktrees): bound shared worktree list scans (#9786)

This commit is contained in:
Brennan Benson
2026-07-21 16:10:01 -07:00
committed by GitHub
parent 21e26de456
commit 71bbfa022d
3 changed files with 90 additions and 19 deletions
+7 -3
View File
@@ -41,6 +41,7 @@ import {
forceDeleteLocalBranch,
listWorktrees,
removeWorktree,
WORKTREE_LIST_TIMEOUT_MS,
WORKTREE_REMOVAL_PREFLIGHT_TIMEOUT_MS
} from './worktree'
@@ -1009,7 +1010,8 @@ describe('listWorktrees', () => {
])
expect(gitExecFileAsyncMock).toHaveBeenCalledWith(['worktree', 'list', '--porcelain', '-z'], {
cwd: 'C:\\Users\\me\\repo',
wslDistro: 'Ubuntu'
wslDistro: 'Ubuntu',
timeout: WORKTREE_LIST_TIMEOUT_MS
})
expect(translateWslOutputPathsMock).toHaveBeenCalledWith(
expect.any(String),
@@ -1030,7 +1032,8 @@ describe('listWorktrees', () => {
await expect(listWorktrees('/workspace/deleted-repo')).resolves.toEqual([])
expect(gitExecFileAsyncMock).toHaveBeenCalledWith(['worktree', 'list', '--porcelain', '-z'], {
cwd: '/workspace/deleted-repo'
cwd: '/workspace/deleted-repo',
timeout: WORKTREE_LIST_TIMEOUT_MS
})
expect(statMock).toHaveBeenCalledWith('/workspace/deleted-repo')
expect(warnSpy).toHaveBeenCalledWith(
@@ -1052,7 +1055,8 @@ describe('listWorktrees', () => {
await expect(listWorktrees('/private/tmp/orca-issue-1582-test/my-repo')).resolves.toEqual([])
expect(gitExecFileAsyncMock).toHaveBeenCalledWith(['worktree', 'list', '--porcelain', '-z'], {
cwd: '/private/tmp/orca-issue-1582-test/my-repo'
cwd: '/private/tmp/orca-issue-1582-test/my-repo',
timeout: WORKTREE_LIST_TIMEOUT_MS
})
expect(warnSpy).not.toHaveBeenCalled()
warnSpy.mockRestore()