Files
orca/src/shared/git-blob-absence.ts
T
Neil 328caa2160 fix(git): reduce queries and preserve data across execution hosts (#24602)
* fix(git): reduce queries and preserve data across execution hosts

* fix(ci): exercise pinned Git and serialize mobile dependency entrypoints

* fix(relay): preserve fresh diff retries after hung shared reads

* test(git): wait for fetch barrier before canceling preparation

* fix(i18n): describe index-preserving discard in every locale

* fix(git): retain clone diagnostics and allow WSL policy startup

* test(git): refresh default-base and branch-safety fixtures
2026-10-02 18:05:37 -07:00

22 lines
985 B
TypeScript

import { readGitCommandFailureStderr, readGitCommandFailureText } from './git-command-failure-text'
/** A missing path diagnostic proves absence; exit 128 alone also covers corrupt objects. */
export function isMissingGitBlobPath(error: unknown, filePath: string, oid?: string): boolean {
if (typeof error !== 'object' || error === null || !('code' in error) || error.code !== 128) {
return false
}
const text = readGitCommandFailureStderr(error) ?? readGitCommandFailureText(error)
const diagnostic = text.trim().replace(/^fatal: Path /, 'fatal: path ')
const prefix = `fatal: path '${filePath}' `
const endings =
oid === undefined
? [
'exists on disk, but not in the index',
'does not exist (neither on disk nor in the index)'
]
: [`exists on disk, but not in '${oid}'`, `does not exist in '${oid}'`]
return endings.some(
(ending) => diagnostic === `${prefix}${ending}` || diagnostic === `${prefix}${ending}.`
)
}