hide some methods under #cfg(test)

This commit is contained in:
Nikita Galaiko 2023-10-12 15:35:50 +02:00 committed by GitButler
parent 878c23c229
commit cba2d2fc4f
2 changed files with 9 additions and 2 deletions

View File

@ -17,6 +17,7 @@ impl<'a> From<&'a Repository> for &'a git2::Repository {
}
impl Repository {
#[cfg(test)]
pub fn init_bare<P: AsRef<path::Path>>(path: P) -> Result<Self> {
let inner = git2::Repository::init_bare(path)?;
Ok(Repository(inner))
@ -31,6 +32,7 @@ impl Repository {
let inner = git2::Repository::open(path)?;
Ok(Repository(inner))
}
pub fn init_opts<P: AsRef<path::Path>>(
path: P,
opts: &git2::RepositoryInitOptions,

View File

@ -32,8 +32,13 @@ impl Default for TestProject {
.expect("failed to commit");
let remote_path = temp_dir();
let remote_repository =
git::Repository::init_bare(remote_path).expect("failed to init repository");
let remote_repository = git::Repository::init_opts(
remote_path,
git2::RepositoryInitOptions::new()
.bare(true)
.external_template(false),
)
.expect("failed to init repository");
{
let mut remote = local_repository