|
1 | 1 | #![allow(clippy::result_large_err)] |
2 | | -use crate::{bstr::BString, config::tree::gitoxide, remote}; |
| 2 | +use crate::{bstr::BString, remote}; |
3 | 3 |
|
4 | 4 | type ConfigureRemoteFn = |
5 | 5 | Box<dyn FnMut(crate::Remote<'_>) -> Result<crate::Remote<'_>, Box<dyn std::error::Error + Send + Sync>>>; |
@@ -46,6 +46,8 @@ pub enum Error { |
46 | 46 | #[error(transparent)] |
47 | 47 | Init(#[from] crate::init::Error), |
48 | 48 | #[error(transparent)] |
| 49 | + CommitterOrFallback(#[from] crate::config::time::Error), |
| 50 | + #[error(transparent)] |
49 | 51 | UrlParse(#[from] gix_url::parse::Error), |
50 | 52 | #[error("Failed to turn a the relative file url \"{}\" into an absolute one", url.to_bstring())] |
51 | 53 | CanonicalizeUrl { |
@@ -102,18 +104,7 @@ impl PrepareFetch { |
102 | 104 | url: url.clone(), |
103 | 105 | source: err, |
104 | 106 | })?; |
105 | | - if repo.committer().is_none() { |
106 | | - let mut config = gix_config::File::new(gix_config::file::Metadata::api()); |
107 | | - config |
108 | | - .set_raw_value(&gitoxide::Committer::NAME_FALLBACK, "no name configured during clone") |
109 | | - .expect("works - statically known"); |
110 | | - config |
111 | | - .set_raw_value(&gitoxide::Committer::EMAIL_FALLBACK, "noEmailAvailable@example.com") |
112 | | - .expect("works - statically known"); |
113 | | - let mut repo_config = repo.config_snapshot_mut(); |
114 | | - repo_config.append(config); |
115 | | - repo_config.commit().expect("configuration is still valid"); |
116 | | - } |
| 107 | + repo.committer_or_set_generic_fallback()?; |
117 | 108 | Ok(PrepareFetch { |
118 | 109 | url, |
119 | 110 | #[cfg(any(feature = "async-network-client", feature = "blocking-network-client"))] |
|
0 commit comments