diff options
Diffstat (limited to 'vendor/gix/src/config/cache')
-rw-r--r-- | vendor/gix/src/config/cache/access.rs | 3 | ||||
-rw-r--r-- | vendor/gix/src/config/cache/init.rs | 18 | ||||
-rw-r--r-- | vendor/gix/src/config/cache/util.rs | 12 |
3 files changed, 20 insertions, 13 deletions
diff --git a/vendor/gix/src/config/cache/access.rs b/vendor/gix/src/config/cache/access.rs index 77324efe3..cea56f973 100644 --- a/vendor/gix/src/config/cache/access.rs +++ b/vendor/gix/src/config/cache/access.rs @@ -47,8 +47,7 @@ impl Cache { .get_or_init(|| { self.resolved .string_by_key(Gitoxide::USER_AGENT.logical_name().as_str()) - .map(|s| s.to_string()) - .unwrap_or_else(|| crate::env::agent().into()) + .map_or_else(|| crate::env::agent().into(), |s| s.to_string()) }) .to_owned(); ("agent", Some(gix_protocol::agent(agent).into())) diff --git a/vendor/gix/src/config/cache/init.rs b/vendor/gix/src/config/cache/init.rs index ee20e0354..6fcbcc4ec 100644 --- a/vendor/gix/src/config/cache/init.rs +++ b/vendor/gix/src/config/cache/init.rs @@ -151,7 +151,7 @@ impl Cache { lenient_config, )?; let object_kind_hint = util::disambiguate_hint(&config, lenient_config)?; - let (pack_cache_bytes, object_cache_bytes) = + let (static_pack_cache_limit_bytes, pack_cache_bytes, object_cache_bytes) = util::parse_object_caches(&config, lenient_config, filter_config_section)?; // NOTE: When adding a new initial cache, consider adjusting `reread_values_and_clear_caches()` as well. Ok(Cache { @@ -159,6 +159,7 @@ impl Cache { use_multi_pack_index, object_hash, object_kind_hint, + static_pack_cache_limit_bytes, pack_cache_bytes, object_cache_bytes, reflog, @@ -222,8 +223,11 @@ impl Cache { self.url_rewrite = Default::default(); self.diff_renames = Default::default(); self.diff_algorithm = Default::default(); - (self.pack_cache_bytes, self.object_cache_bytes) = - util::parse_object_caches(config, self.lenient_config, self.filter_config_section)?; + ( + self.static_pack_cache_limit_bytes, + self.pack_cache_bytes, + self.object_cache_bytes, + ) = util::parse_object_caches(config, self.lenient_config, self.filter_config_section)?; #[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))] { self.url_scheme = Default::default(); @@ -423,10 +427,6 @@ fn apply_environment_overrides( objects, &[ { - let key = &gitoxide::Objects::NO_REPLACE; - (env(key), key.name) - }, - { let key = &gitoxide::Objects::REPLACE_REF_BASE; (env(key), key.name) }, @@ -487,6 +487,10 @@ fn apply_environment_overrides( let key = &Core::SSH_COMMAND; (env(key), key.name, git_prefix) }, + { + let key = &Core::USE_REPLACE_REFS; + (env(key), key.name, objects) + }, ] { if let Some(value) = var_as_bstring(var, permission) { section.push_with_comment( diff --git a/vendor/gix/src/config/cache/util.rs b/vendor/gix/src/config/cache/util.rs index d5a0a4acb..7c478fcf9 100644 --- a/vendor/gix/src/config/cache/util.rs +++ b/vendor/gix/src/config/cache/util.rs @@ -40,8 +40,7 @@ pub(crate) fn config_bool( ); config .boolean_by_key(key_str) - .map(|res| key.enrich_error(res)) - .unwrap_or(Ok(default)) + .map_or(Ok(default), |res| key.enrich_error(res)) .map_err(Error::from) .with_lenient_default(lenient) } @@ -73,7 +72,12 @@ pub(crate) fn parse_object_caches( config: &gix_config::File<'static>, lenient: bool, mut filter_config_section: fn(&gix_config::file::Metadata) -> bool, -) -> Result<(Option<usize>, usize), Error> { +) -> Result<(Option<usize>, Option<usize>, usize), Error> { + let static_pack_cache_limit = config + .integer_filter_by_key("core.deltaBaseCacheLimit", &mut filter_config_section) + .map(|res| gitoxide::Core::DEFAULT_PACK_CACHE_MEMORY_LIMIT.try_into_usize(res)) + .transpose() + .with_leniency(lenient)?; let pack_cache_bytes = config .integer_filter_by_key("core.deltaBaseCacheLimit", &mut filter_config_section) .map(|res| Core::DELTA_BASE_CACHE_LIMIT.try_into_usize(res)) @@ -85,7 +89,7 @@ pub(crate) fn parse_object_caches( .transpose() .with_leniency(lenient)? .unwrap_or_default(); - Ok((pack_cache_bytes, object_cache_bytes)) + Ok((static_pack_cache_limit, pack_cache_bytes, object_cache_bytes)) } pub(crate) fn parse_core_abbrev( |