diff --git a/crates/core/src/git/repository/mod.rs b/crates/core/src/git/repository/mod.rs index fd038f2..c93ab81 100644 --- a/crates/core/src/git/repository/mod.rs +++ b/crates/core/src/git/repository/mod.rs @@ -1,6 +1,7 @@ // use crate::{ git::{ + self, repository::{ open::{OpenRepository, OpenRepositoryLike}, test::TestRepository, @@ -47,7 +48,9 @@ pub fn open( ) -> Result> { let open_repository = if repo_details.gitdir.exists() { info!("Local copy found - opening..."); - repository_factory.open(repo_details)? + let repo = repository_factory.open(repo_details)?; + repo.fetch()?; + repo } else { info!("Local copy not found - cloning..."); repository_factory.git_clone(repo_details)? @@ -117,6 +120,9 @@ pub enum Error { #[error("git clone: {0}")] Clone(String), + #[error("git fetch: {0}")] + FetchError(#[from] git::fetch::Error), + #[error("open: {0}")] Open(String), diff --git a/crates/core/src/git/repository/open/oreal.rs b/crates/core/src/git/repository/open/oreal.rs index dd8e584..136da28 100644 --- a/crates/core/src/git/repository/open/oreal.rs +++ b/crates/core/src/git/repository/open/oreal.rs @@ -67,6 +67,7 @@ impl super::OpenRepositoryLike for RealOpenRepository { #[tracing::instrument(skip_all)] #[cfg(not(tarpaulin_include))] // would require writing to external service fn fetch(&self) -> Result<(), git::fetch::Error> { + info!("Fetching"); gix::command::prepare("/usr/bin/git fetch --prune") .with_context(gix::diff::command::Context { git_dir: Some(