Skip to main content

batch_content_missing

Function batch_content_missing 

Source
pub fn batch_content_missing(
    common_dir: &Path,
    requests: &[&CommitRequest],
) -> bool
Expand description

What: Whether any object the requests of a batch depend on is gone from the repository’s object store. Why: The landing asks this before it imports anything or moves the branch: fast-import dies on a missing blob and leaves a crash report in the Git directory, and Git moves a branch to a commit whose objects are gone without looking. Loose objects are found with one lookup each; the packs are opened only when an object is not loose. A store the in-process reader cannot open answers false, which leaves the decision to Git, as for the client’s own check.

In TS you’d write (pseudocode):

requests.flatMap(namesOf).some((name) => !loose(name) && !(await packs()).has(name))