use crate::object::cache::ObjectCache; use crate::policy::{DefaultPolicy, Policy}; use std::path::PathBuf; use std::sync::Arc; pub mod error; pub use error::Error; use gitlfs::LfsObjectStore; use storage::StorageRepository; pub mod gitcli; pub mod policy; pub mod validate; pub mod analysis; pub mod archive; pub mod blob; pub mod commit; pub mod conflict; pub mod diff; pub mod gc; pub mod graphql; pub mod hook; pub mod lfs; pub mod log; pub mod object; pub mod pack; pub mod patch; pub mod pipeline; pub mod refs; pub mod remote; pub mod signature; pub mod submodule; pub mod tag; pub mod tree; pub(crate) mod usecase_cache; #[derive(Clone)] pub struct GitRepository { pub path: PathBuf, pub cache: ObjectCache, pub policy: Policy, pub storage: Arc, pub lfs: Arc, } impl GitRepository { pub fn repo(&self) -> Result { gix::open(&self.path).map_err(|e| crate::Error::Open(e.to_string())) } pub fn new( path: impl Into, cache: ObjectCache, storage: Arc, ) -> Self { let lfs = Arc::new(gitlfs::DefaultLfsStore::new(storage.clone(), "lfs")); Self { path: path.into(), cache, policy: Arc::new(DefaultPolicy), storage, lfs, } } pub fn with_policy(mut self, policy: Policy) -> Self { self.policy = policy; self } pub fn with_lfs_store(mut self, lfs: Arc) -> Self { self.lfs = lfs; self } }