mirror of
https://github.com/stablyai/orca.git
synced 2026-10-29 16:17:51 +00:00
Honor configured SSH for remote-base worktrees (#5739)
This commit is contained in:
@@ -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')
|
||||
]
|
||||
])
|
||||
})
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user