Skip to content

add committer fallback for fetch #2048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions gix/src/clone/fetch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
bstr::{BString, ByteSlice},
clone::PrepareFetch,
config::tree::gitoxide,
};

/// The error returned by [`PrepareFetch::fetch_only()`].
Expand Down Expand Up @@ -80,6 +81,19 @@ impl PrepareFetch {
.as_mut()
.expect("user error: multiple calls are allowed only until it succeeds");

if repo.committer().is_none() {
let mut config = gix_config::File::new(gix_config::file::Metadata::api());
config
.set_raw_value(&gitoxide::Committer::NAME_FALLBACK, "no name configured during fetch")
.expect("works - statically known");
config
.set_raw_value(&gitoxide::Committer::EMAIL_FALLBACK, "[email protected]")
.expect("works - statically known");
let mut repo_config = repo.config_snapshot_mut();
repo_config.append(config);
repo_config.commit().expect("configuration is still valid");
}

if !self.config_overrides.is_empty() {
let mut snapshot = repo.config_snapshot_mut();
snapshot.append_config(&self.config_overrides, gix_config::Source::Api)?;
Expand Down
Loading