mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
* Add project Windows runtime selection * Fix project Windows runtime selection Co-authored-by: Orca <help@stably.ai> * fix: preserve WSL shell variables --------- Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: Neil <neil@stably.ai>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { gitExecFileAsync } from '../git/runner'
|
|
import type { SshGitProvider } from '../providers/ssh-git-provider'
|
|
|
|
type LocalGitExecOptions = {
|
|
cwd: string
|
|
wslDistro?: string
|
|
}
|
|
|
|
// Why: the relay's read-only git.exec channel rejects `fetch`, so SSH repos
|
|
// must use the dedicated git.fetchRemoteTrackingRef RPC.
|
|
export async function fetchPrHeadTrackingRef(
|
|
repo: { path: string; connectionId?: string | null },
|
|
sshGitProvider: SshGitProvider | null | undefined,
|
|
remote: string,
|
|
branch: string,
|
|
options: { localGitExecOptions?: LocalGitExecOptions } = {}
|
|
): Promise<void> {
|
|
const ref = `refs/remotes/${remote}/${branch}`
|
|
if (!repo.connectionId) {
|
|
await gitExecFileAsync(
|
|
['fetch', remote, `+refs/heads/${branch}:${ref}`],
|
|
options.localGitExecOptions ?? { cwd: repo.path }
|
|
)
|
|
return
|
|
}
|
|
if (!sshGitProvider) {
|
|
throw new Error('SSH Git provider is not available. Reconnect to this target and try again.')
|
|
}
|
|
await sshGitProvider.fetchRemoteTrackingRef(repo.path, remote, branch, ref)
|
|
}
|