use std::sync::atomic::AtomicBool; use derive_more::Deref as _; use git_next_config::GitDir; use crate::{ repository::{open::OpenRepository, Error, RepositoryLike}, RepoDetails, }; pub struct RealRepository; impl RepositoryLike for RealRepository { fn open(&self, gitdir: &GitDir) -> Result { let gix_repo = gix::ThreadSafeRepository::open(gitdir.to_path_buf())?.to_thread_local(); Ok(OpenRepository::real(gix_repo)) } #[tracing::instrument(skip_all)] fn git_clone(&self, repo_details: &RepoDetails) -> Result { tracing::info!("creating"); use secrecy::ExposeSecret; let (gix_repo, _outcome) = gix::prepare_clone_bare( repo_details.origin().expose_secret().as_str(), repo_details.gitdir.deref(), )? .fetch_only(gix::progress::Discard, &AtomicBool::new(false))?; tracing::info!("created"); Ok(OpenRepository::real(gix_repo)) } }