|
1 | 1 | use crate::{ |
2 | 2 | bstr::{BString, ByteSlice}, |
3 | 3 | clone::PrepareFetch, |
4 | | - config::tree::gitoxide, |
5 | 4 | }; |
6 | 5 |
|
7 | 6 | /// The error returned by [`PrepareFetch::fetch_only()`]. |
@@ -46,6 +45,8 @@ pub enum Error { |
46 | 45 | wanted: gix_ref::PartialName, |
47 | 46 | candidates: Vec<BString>, |
48 | 47 | }, |
| 48 | + #[error(transparent)] |
| 49 | + CommitterOrFallback(#[from] crate::config::time::Error), |
49 | 50 | } |
50 | 51 |
|
51 | 52 | /// Modification |
@@ -81,23 +82,11 @@ impl PrepareFetch { |
81 | 82 | .as_mut() |
82 | 83 | .expect("user error: multiple calls are allowed only until it succeeds"); |
83 | 84 |
|
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, "noEmailAvailable@example.com") |
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 | | - } |
| 85 | + repo.committer_or_set_generic_fallback()?; |
96 | 86 |
|
97 | 87 | if !self.config_overrides.is_empty() { |
98 | 88 | let mut snapshot = repo.config_snapshot_mut(); |
99 | 89 | snapshot.append_config(&self.config_overrides, gix_config::Source::Api)?; |
100 | | - snapshot.commit()?; |
101 | 90 | } |
102 | 91 |
|
103 | 92 | let remote_name = match self.remote_name.as_ref() { |
|
0 commit comments