Skip to main content

git_reads_back

Function git_reads_back 

Source
pub fn git_reads_back(
    scratch: &Path,
    name: &str,
    pack: &[u8],
) -> Result<Vec<(String, Vec<u8>)>>
Expand description

What stock git reads back out of a pack this crate emitted: every object in it, by oid, as (kind, bytes).

git_accepts proves a pack is well formed and connected. It cannot prove the bytes are the right bytes, and that is precisely the failure mode a computed delta introduces: a wrong copy offset produces a pack index-pack indexes happily, because the oid it files the entry under is the one it computed from the entry’s own content. Only reading the content back and comparing it against what the store holds can see it — P-001, applied output rather than a state round-trip.

The pack goes in through index-pack --stdin, which lands it in the repository’s objects/pack where cat-file can reach it; git_accepts deliberately does not, because a verdict must not depend on the repository having adopted the objects.