Skip to content

Commit 62e4bab

Browse files
committed
add committer fallback for fetch
1 parent 073487b commit 62e4bab

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

gix/src/clone/fetch/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{
22
bstr::{BString, ByteSlice},
33
clone::PrepareFetch,
4+
config::tree::gitoxide,
45
};
56

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

84+
if repo.committer().is_none() {
85+
let mut config = gix_config::File::new(gix_config::file::Metadata::api());
86+
config
87+
.set_raw_value(&gitoxide::Committer::NAME_FALLBACK, "no name configured during fetch")
88+
.expect("works - statically known");
89+
config
90+
.set_raw_value(&gitoxide::Committer::EMAIL_FALLBACK, "[email protected]")
91+
.expect("works - statically known");
92+
let mut repo_config = repo.config_snapshot_mut();
93+
repo_config.append(config);
94+
repo_config.commit().expect("configuration is still valid");
95+
}
96+
8397
if !self.config_overrides.is_empty() {
8498
let mut snapshot = repo.config_snapshot_mut();
8599
snapshot.append_config(&self.config_overrides, gix_config::Source::Api)?;

0 commit comments

Comments
 (0)