const HEADER_MAX_SIZE: usize = 64;
use std::path::{Path, PathBuf};
use gix_features::fs;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Options {
pub object_hash: gix_hash::Kind,
pub alloc_limit_bytes: Option<usize>,
pub compression: gix_zlib::Compression,
}
impl Default for Options {
fn default() -> Self {
Options {
object_hash: Default::default(),
alloc_limit_bytes: None,
compression: gix_zlib::Compression::BEST_SPEED,
}
}
}
#[derive(Clone, PartialEq, Eq)]
pub struct Store {
pub(crate) path: PathBuf,
pub(crate) object_hash: gix_hash::Kind,
pub(crate) alloc_limit_bytes: Option<usize>,
pub(crate) compression: gix_zlib::Compression,
}
impl Store {
pub fn at(objects_directory: impl Into<PathBuf>, options: Options) -> Store {
let Options {
object_hash,
alloc_limit_bytes,
compression,
} = options;
Store {
path: objects_directory.into(),
object_hash,
alloc_limit_bytes,
compression,
}
}
pub fn path(&self) -> &Path {
&self.path
}
pub fn object_hash(&self) -> gix_hash::Kind {
self.object_hash
}
}
fn hash_path(id: &gix_hash::oid, mut root: PathBuf) -> PathBuf {
let mut hex = gix_hash::Kind::hex_buf();
let hex = id.hex_to_buf(hex.as_mut());
root.push(&hex[..2]);
root.push(&hex[2..]);
root
}
pub mod find;
pub mod iter;
pub mod verify;
pub struct Iter {
inner: fs::walkdir::DirEntryIter,
hash_hex_len: usize,
}
pub mod write;