Skip to main content

verify_pack

Function verify_pack 

Source
pub fn verify_pack(
    pack: &[u8],
    idx: &[u8],
    algo: HashAlgo,
    resolve_external: &ExternalResolver<'_>,
) -> Result<PackVerification>
Expand description

Verifies a packfile against its .idx (git verify-pack).

Every object in the pack is decoded (resolving all deltas) and re-hashed; because the id is derived from the decoded content, any corruption changes an object’s id so it no longer matches the index. The check therefore confirms that (a) all deltas resolve, (b) every decoded object’s id is present in the index, and (c) the object counts agree. resolve_external supplies bases for a thin pack; pass a resolver that errors (e.g. |_| Err(Error::NotFound…)) for a self-contained pack.