use std::sync::atomic::AtomicBool;
use git_features::progress::Progress;
use crate::data::File;
pub mod checksum {
pub type Error = crate::verify::checksum::Error;
}
impl File {
pub fn checksum(&self) -> git_hash::ObjectId {
git_hash::ObjectId::from(&self.data[self.data.len() - self.hash_len..])
}
pub fn verify_checksum(
&self,
progress: impl Progress,
should_interrupt: &AtomicBool,
) -> Result<git_hash::ObjectId, checksum::Error> {
crate::verify::checksum_on_disk_or_mmap(
self.path(),
&self.data,
self.checksum(),
self.object_hash,
progress,
should_interrupt,
)
}
}