mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +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
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
function getGitErrorText(error: unknown): string {
|
|
if (typeof error !== 'object' || error === null) {
|
|
return error instanceof Error ? error.message : String(error)
|
|
}
|
|
const values = ['message', 'stderr', 'stdout']
|
|
.map((key) => (error as Record<string, unknown>)[key])
|
|
.filter((value): value is string => typeof value === 'string')
|
|
return values.join('\n')
|
|
}
|
|
|
|
function getGitErrorCode(error: unknown): string | undefined {
|
|
return typeof error === 'object' && error !== null && 'code' in error
|
|
? String((error as { code?: unknown }).code)
|
|
: undefined
|
|
}
|
|
|
|
export function isUnsupportedWorktreeListZError(error: unknown): boolean {
|
|
// `-z` is this fixed command's only post-baseline flag, so exit 129 is the
|
|
// locale-independent rejection signal on old native, WSL, and SSH Git.
|
|
if (getGitErrorCode(error) === '129') {
|
|
return true
|
|
}
|
|
return /(?:unknown|invalid|unrecognized) (?:switch|option).*`?-?z'?/i.test(getGitErrorText(error))
|
|
}
|
|
|
|
export function isUnsupportedRevParsePathFormatError(error: unknown): boolean {
|
|
return /(?:unknown|invalid|unrecognized).*(?:--path-format|path-format)/i.test(
|
|
getGitErrorText(error)
|
|
)
|
|
}
|
|
|
|
export function hasUnsupportedRevParsePathFormatEcho(output: string): boolean {
|
|
return output.split(/\r?\n/).some((line) => line.startsWith('--path-format'))
|
|
}
|