diff options
Diffstat (limited to 'vendor/gix/src/config/snapshot')
-rw-r--r-- | vendor/gix/src/config/snapshot/access.rs | 13 | ||||
-rw-r--r-- | vendor/gix/src/config/snapshot/credential_helpers.rs | 24 |
2 files changed, 27 insertions, 10 deletions
diff --git a/vendor/gix/src/config/snapshot/access.rs b/vendor/gix/src/config/snapshot/access.rs index 7dc593880..6b98cf42d 100644 --- a/vendor/gix/src/config/snapshot/access.rs +++ b/vendor/gix/src/config/snapshot/access.rs @@ -4,9 +4,8 @@ use std::borrow::Cow; use gix_features::threading::OwnShared; use gix_macros::momo; -use crate::bstr::ByteSlice; use crate::{ - bstr::{BStr, BString}, + bstr::{BStr, BString, ByteSlice}, config::{CommitAutoRollback, Snapshot, SnapshotMut}, }; @@ -118,9 +117,13 @@ impl<'repo> SnapshotMut<'repo> { } let value = new_value.into(); key.validate(value)?; - let current = self - .config - .set_raw_value(key.section().name(), None, key.name(), value)?; + let section = key.section(); + let current = match section.parent() { + Some(parent) => self + .config + .set_raw_value(parent.name(), Some(section.name().into()), key.name(), value)?, + None => self.config.set_raw_value(section.name(), None, key.name(), value)?, + }; Ok(current.map(std::borrow::Cow::into_owned)) } diff --git a/vendor/gix/src/config/snapshot/credential_helpers.rs b/vendor/gix/src/config/snapshot/credential_helpers.rs index 189e74471..54499a1c3 100644 --- a/vendor/gix/src/config/snapshot/credential_helpers.rs +++ b/vendor/gix/src/config/snapshot/credential_helpers.rs @@ -2,11 +2,12 @@ use std::{borrow::Cow, convert::TryFrom}; pub use error::Error; -use crate::config::cache::util::IgnoreEmptyPath; +use crate::config::cache::util::ApplyLeniency; use crate::{ bstr::{ByteSlice, ByteVec}, config::{ - tree::{credential, Core, Credential, Key}, + cache::util::IgnoreEmptyPath, + tree::{credential, gitoxide::Credentials, Core, Credential, Key}, Snapshot, }, }; @@ -25,6 +26,8 @@ mod error { }, #[error("core.askpass could not be read")] CoreAskpass(#[from] gix_config::path::interpolate::Error), + #[error(transparent)] + BooleanConfig(#[from] crate::config::boolean::Error), } } @@ -144,16 +147,27 @@ impl Snapshot<'_> { .transpose() .ignore_empty()? .map(|c| Cow::Owned(c.into_owned())), - ..Default::default() + mode: self + .try_boolean(Credentials::TERMINAL_PROMPT.logical_name().as_str()) + .map(|val| Credentials::TERMINAL_PROMPT.enrich_error(val)) + .transpose() + .with_leniency(self.repo.config.lenient_config)? + .and_then(|val| (!val).then_some(gix_prompt::Mode::Disable)) + .unwrap_or_default(), } - .apply_environment(allow_git_env, allow_ssh_env, allow_git_env); + .apply_environment(allow_git_env, allow_ssh_env, false /* terminal prompt */); Ok(( gix_credentials::helper::Cascade { programs, use_http_path, // The default ssh implementation uses binaries that do their own auth, so our passwords aren't used. query_user_only: url.scheme == gix_url::Scheme::Ssh, - ..Default::default() + stderr: self + .try_boolean(Credentials::HELPER_STDERR.logical_name().as_str()) + .map(|val| Credentials::HELPER_STDERR.enrich_error(val)) + .transpose() + .with_leniency(self.repo.options.lenient_config)? + .unwrap_or(true), }, gix_credentials::helper::Action::get_for_url(url.to_bstring()), prompt_options, |