Honor configured SSH for remote-base worktrees (#5739)

This commit is contained in:
Brennan Benson
2026-06-18 15:52:55 -07:00
committed by GitHub
parent a0b19f356f
commit afde3a3741
5 changed files with 404 additions and 22 deletions
+12 -4
View File
@@ -28,6 +28,14 @@ function fetchCallCount(): number {
).length
}
function exactBaseRefreshOptions(cwd: string): {
cwd: string
timeout: number
useConfiguredSshCommandForNetwork: boolean
} {
return { cwd, timeout: 60_000, useConfiguredSshCommandForNetwork: true }
}
function mockFetchResults(results: (Promise<unknown> | unknown)[]): void {
let fetchIndex = 0
gitExecFileAsyncMock.mockImplementation((argv: string[]) => {
@@ -175,7 +183,7 @@ describe('OrcaRuntimeService.fetchRemoteWithCache', () => {
expect(gitExecFileAsyncMock).toHaveBeenCalledWith(
['fetch', '--no-tags', 'origin', '+refs/heads/main:refs/remotes/origin/main'],
{ cwd: '/repo/f' }
exactBaseRefreshOptions('/repo/f')
)
})
@@ -289,7 +297,7 @@ describe('OrcaRuntimeService.fetchRemoteWithCache', () => {
expect(fetchCalls).toEqual([
[
['fetch', '--no-tags', 'origin', '+refs/heads/main:refs/remotes/origin/main'],
{ cwd: '/repo/h' }
exactBaseRefreshOptions('/repo/h')
],
[['fetch', 'origin'], { cwd: '/repo/h' }]
])
@@ -336,7 +344,7 @@ describe('OrcaRuntimeService.fetchRemoteWithCache', () => {
[['fetch', 'origin'], { cwd: '/repo/i' }],
[
['fetch', '--no-tags', 'origin', '+refs/heads/main:refs/remotes/origin/main'],
{ cwd: '/repo/i' }
exactBaseRefreshOptions('/repo/i')
]
])
})
@@ -382,7 +390,7 @@ describe('OrcaRuntimeService.fetchRemoteWithCache', () => {
[['fetch', 'origin'], { cwd: '/repo/i-fail' }],
[
['fetch', '--no-tags', 'origin', '+refs/heads/main:refs/remotes/origin/main'],
{ cwd: '/repo/i-fail' }
exactBaseRefreshOptions('/repo/i-fail')
]
])
})
+5 -1
View File
@@ -1915,7 +1915,11 @@ describe('OrcaRuntimeService', () => {
await vi.waitFor(() => {
expect(gitSpy).toHaveBeenCalledWith(
['fetch', '--no-tags', 'origin', '+refs/heads/main:refs/remotes/origin/main'],
{ cwd: TEST_REPO_PATH }
{
cwd: TEST_REPO_PATH,
useConfiguredSshCommandForNetwork: true,
timeout: 60_000
}
)
})
expect(addWorktree).not.toHaveBeenCalled()
+8 -1
View File
@@ -11558,7 +11558,14 @@ export class OrcaRuntimeService {
}
return gitExecFileAsync(
['fetch', '--no-tags', base.remote, `+refs/heads/${base.branch}:${base.ref}`],
{ cwd: repoPath, ...gitOptions }
{
cwd: repoPath,
...gitOptions,
// Why: exact remote-base refresh is the network gate for worktree
// creation, so honor repo SSH routing and bound custom wrappers.
useConfiguredSshCommandForNetwork: true,
timeout: 60_000
}
)
.then((): RemoteFetchResult => {
this.rememberFreshFetchCompletedAt(key)