24 lines
909 B
Rust
24 lines
909 B
Rust
|
use super::*;
|
||
|
pub struct RealRepository;
|
||
|
impl RepositoryLike for RealRepository {
|
||
|
fn open(&self, gitdir: &GitDir) -> Result<open::OpenRepository, Error> {
|
||
|
Ok(open::OpenRepository::Real(open::RealOpenRepository::new(
|
||
|
Arc::new(Mutex::new(
|
||
|
gix::ThreadSafeRepository::open(gitdir.to_path_buf())?.to_thread_local(),
|
||
|
)),
|
||
|
)))
|
||
|
}
|
||
|
|
||
|
fn git_clone(&self, repo_details: &RepoDetails) -> Result<open::OpenRepository, Error> {
|
||
|
use secrecy::ExposeSecret;
|
||
|
let origin = repo_details.origin();
|
||
|
let (repository, _outcome) =
|
||
|
gix::prepare_clone_bare(origin.expose_secret().as_str(), repo_details.gitdir.deref())?
|
||
|
.fetch_only(gix::progress::Discard, &AtomicBool::new(false))?;
|
||
|
|
||
|
Ok(open::OpenRepository::Real(open::RealOpenRepository::new(
|
||
|
Arc::new(Mutex::new(repository)),
|
||
|
)))
|
||
|
}
|
||
|
}
|