gix_pack::verify

Function checksum_on_disk_or_mmap

source
pub fn checksum_on_disk_or_mmap(
    data_path: &Path,
    data: &[u8],
    expected: ObjectId,
    object_hash: Kind,
    progress: &mut dyn Progress,
    should_interrupt: &AtomicBool,
) -> Result<ObjectId, Error>
Expand description

Calculate the hash of the given kind by trying to read the file from disk at data_path or falling back on the mapped content in data. Ok(desired_hash) or Err(Some(actual_hash)) is returned if the hash matches or mismatches. If the Err(None) is returned, the operation was interrupted.