use anyhow::Result;
use std::path::Path;
pub mod git_shell;
pub trait RepositoryBackend {
fn install(&self, url: &str, target: &Path, revision: Option<&str>) -> Result<()>;
fn update(&self, target: &Path, url: &str, revision: Option<&str>) -> Result<()>;
fn is_clean(&self, target: &Path) -> Result<bool>;
}
#[must_use]
pub fn backend() -> Box<dyn RepositoryBackend> {
Box::new(git_shell::GitShellBackend)
}
pub fn install(url: &str, target: &Path, revision: Option<&str>) -> Result<()> {
backend().install(url, target, revision)
}
pub fn update(target: &Path, url: &str, revision: Option<&str>) -> Result<()> {
backend().update(target, url, revision)
}
pub fn is_clean(target: &Path) -> Result<bool> {
backend().is_clean(target)
}