diff --git a/src/engines/git.rs b/src/engines/git.rs index ca0443a..0fdd47c 100644 --- a/src/engines/git.rs +++ b/src/engines/git.rs @@ -94,6 +94,9 @@ impl GitEngine { "Make sure that your internet connectivity is working correctly, and that your local git configuration is able to clone this repo.", e))?; + trace!("Configure fallback committer information"); + self.ensure_committer(&repository)?; + trace!("Configuring core.bare for Git repository"); self.update_config(&repository, |c| { c.set_raw_value(&gix::config::tree::Core::BARE, "true").map_err(|e| errors::system_with_internal( @@ -132,6 +135,8 @@ impl GitEngine { ) })?; + self.ensure_committer(&repository)?; + let original_head = repository.head_id().ok(); let default_refspecs = vec!["+refs/heads/*:refs/remotes/origin/*".to_string()]; @@ -260,6 +265,27 @@ impl GitEngine { } } + fn ensure_committer(&self, repo: &gix::Repository) -> Result<(), errors::Error> { + if repo.committer().is_none() { + self.update_config(repo, |cfg| { + cfg.set_raw_value( + &gix::config::tree::gitoxide::Committer::NAME_FALLBACK, + "github-backup", + ) + .expect("works - statically known"); + cfg.set_raw_value( + &gix::config::tree::gitoxide::Committer::EMAIL_FALLBACK, + "github-backup@sierrasoftworks.github.io", + ) + .expect("works - statically known"); + + Ok(()) + }) + } else { + Ok(()) + } + } + fn update_config(&self, repo: &gix::Repository, mut update: U) -> Result<(), errors::Error> where U: FnMut(&mut gix::config::File<'_>) -> Result<(), errors::Error>,