mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 00:03:45 +00:00
* fix(git): cache unsupported capabilities per host Old Git worktree, ref-search, and merge-tree fallbacks retried unsupported flags on recurring operations, flooding subprocess traces. Centralize capability probing per native, WSL, and SSH execution host, coalesce concurrent probes, and retry periodically for in-place Git upgrades. * fix(git): recognize real old-Git merge-tree rejection * test(git): enforce real binary compatibility matrix * fix(ci): preserve Git compatibility test ownership * fix(git): retain supported capability state
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { GitCapabilityCache } from '../../shared/git-capability-cache'
|
|
import { parseWslUncPath } from '../../shared/wsl-paths'
|
|
|
|
type LocalGitCapabilityTarget = {
|
|
cwd?: string
|
|
wslDistro?: string
|
|
}
|
|
|
|
const localCapabilitiesByExecutionHost = new Map<string, GitCapabilityCache>()
|
|
// Why: reconnecting creates a new provider, while concurrent IPC/runtime users
|
|
// of one SSH connection must share the same remote Git capability results.
|
|
let sshCapabilitiesByProvider = new WeakMap<object, GitCapabilityCache>()
|
|
|
|
function getLocalGitExecutionHostKey(target: LocalGitCapabilityTarget): string {
|
|
const wslDistro =
|
|
target.wslDistro ?? (target.cwd ? parseWslUncPath(target.cwd)?.distro : undefined)
|
|
return wslDistro ? `wsl:${wslDistro}` : 'local'
|
|
}
|
|
|
|
export function getLocalGitCapabilityCache(
|
|
target: LocalGitCapabilityTarget = {}
|
|
): GitCapabilityCache {
|
|
const executionHost = getLocalGitExecutionHostKey(target)
|
|
let cache = localCapabilitiesByExecutionHost.get(executionHost)
|
|
if (!cache) {
|
|
cache = new GitCapabilityCache()
|
|
localCapabilitiesByExecutionHost.set(executionHost, cache)
|
|
}
|
|
return cache
|
|
}
|
|
|
|
export function getSshGitCapabilityCache(provider: object): GitCapabilityCache {
|
|
let cache = sshCapabilitiesByProvider.get(provider)
|
|
if (!cache) {
|
|
cache = new GitCapabilityCache()
|
|
sshCapabilitiesByProvider.set(provider, cache)
|
|
}
|
|
return cache
|
|
}
|
|
|
|
export function clearGitCapabilityStateForTests(): void {
|
|
localCapabilitiesByExecutionHost.clear()
|
|
sshCapabilitiesByProvider = new WeakMap()
|
|
}
|