diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:26:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:26:03 +0000 |
commit | 9918693037dce8aa4bb6f08741b6812923486c18 (patch) | |
tree | 21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /vendor/gix/src/config/tree/sections | |
parent | Releasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff) | |
download | rustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/config/tree/sections')
-rw-r--r-- | vendor/gix/src/config/tree/sections/core.rs | 6 | ||||
-rw-r--r-- | vendor/gix/src/config/tree/sections/diff.rs | 74 | ||||
-rw-r--r-- | vendor/gix/src/config/tree/sections/fetch.rs | 3 | ||||
-rw-r--r-- | vendor/gix/src/config/tree/sections/gitoxide.rs | 90 | ||||
-rw-r--r-- | vendor/gix/src/config/tree/sections/http.rs | 4 |
5 files changed, 169 insertions, 8 deletions
diff --git a/vendor/gix/src/config/tree/sections/core.rs b/vendor/gix/src/config/tree/sections/core.rs index 2ec5c279e..15ad9f947 100644 --- a/vendor/gix/src/config/tree/sections/core.rs +++ b/vendor/gix/src/config/tree/sections/core.rs @@ -8,13 +8,16 @@ impl Core { pub const ABBREV: Abbrev = Abbrev::new_with_validate("abbrev", &config::Tree::CORE, validate::Abbrev); /// The `core.bare` key. pub const BARE: keys::Boolean = keys::Boolean::new_boolean("bare", &config::Tree::CORE); + /// The `core.bigFileThreshold` key. + pub const BIG_FILE_THRESHOLD: keys::UnsignedInteger = + keys::UnsignedInteger::new_unsigned_integer("bigFileThreshold", &config::Tree::CORE); /// The `core.checkStat` key. pub const CHECK_STAT: CheckStat = CheckStat::new_with_validate("checkStat", &config::Tree::CORE, validate::CheckStat); /// The `core.deltaBaseCacheLimit` key. pub const DELTA_BASE_CACHE_LIMIT: keys::UnsignedInteger = keys::UnsignedInteger::new_unsigned_integer("deltaBaseCacheLimit", &config::Tree::CORE) - .with_environment_override("GITOXIDE_PACK_CACHE_MEMORY") + .with_environment_override("GIX_PACK_CACHE_MEMORY") .with_note("if unset, we default to a small 64 slot fixed-size cache that holds at most 64 full delta base objects of any size. Set to 0 to deactivate it entirely"); /// The `core.disambiguate` key. pub const DISAMBIGUATE: Disambiguate = @@ -95,6 +98,7 @@ impl Section for Core { &[ &Self::ABBREV, &Self::BARE, + &Self::BIG_FILE_THRESHOLD, &Self::CHECK_STAT, &Self::DELTA_BASE_CACHE_LIMIT, &Self::DISAMBIGUATE, diff --git a/vendor/gix/src/config/tree/sections/diff.rs b/vendor/gix/src/config/tree/sections/diff.rs index 7c467b8f5..0ebc13711 100644 --- a/vendor/gix/src/config/tree/sections/diff.rs +++ b/vendor/gix/src/config/tree/sections/diff.rs @@ -1,6 +1,6 @@ use crate::{ config, - config::tree::{keys, Diff, Key, Section}, + config::tree::{keys, Diff, Key, Section, SubSectionRequirement}, }; impl Diff { @@ -17,6 +17,24 @@ impl Diff { ); /// The `diff.renames` key. pub const RENAMES: Renames = Renames::new_renames("renames", &config::Tree::DIFF); + + /// The `diff.<driver>.command` key. + pub const DRIVER_COMMAND: keys::String = keys::String::new_string("command", &config::Tree::DIFF) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); + /// The `diff.<driver>.textconv` key. + pub const DRIVER_TEXTCONV: keys::String = keys::String::new_string("textconv", &config::Tree::DIFF) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); + /// The `diff.<driver>.algorithm` key. + pub const DRIVER_ALGORITHM: Algorithm = + Algorithm::new_with_validate("algorithm", &config::Tree::DIFF, validate::Algorithm) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); + /// The `diff.<driver>.binary` key. + pub const DRIVER_BINARY: Binary = Binary::new_with_validate("binary", &config::Tree::DIFF, validate::Binary) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); + + /// The `diff.external` key. + pub const EXTERNAL: keys::Program = + keys::Program::new_program("external", &config::Tree::DIFF).with_environment_override("GIT_EXTERNAL_DIFF"); } impl Section for Diff { @@ -25,7 +43,16 @@ impl Section for Diff { } fn keys(&self) -> &[&dyn Key] { - &[&Self::ALGORITHM, &Self::RENAME_LIMIT, &Self::RENAMES] + &[ + &Self::ALGORITHM, + &Self::RENAME_LIMIT, + &Self::RENAMES, + &Self::DRIVER_COMMAND, + &Self::DRIVER_TEXTCONV, + &Self::DRIVER_ALGORITHM, + &Self::DRIVER_BINARY, + &Self::EXTERNAL, + ] } } @@ -35,6 +62,9 @@ pub type Algorithm = keys::Any<validate::Algorithm>; /// The `diff.renames` key. pub type Renames = keys::Any<validate::Renames>; +/// The `diff.<driver>.binary` key. +pub type Binary = keys::Any<validate::Binary>; + mod algorithm { use std::borrow::Cow; @@ -67,6 +97,38 @@ mod algorithm { } } +mod binary { + use crate::config::tree::diff::Binary; + + impl Binary { + /// Convert `value` into a tri-state boolean that can take the special value `auto`, resulting in `None`, or is a boolean. + /// If `None` is given, it's treated as implicit boolean `true`, as this method is made to be used + /// with [`gix_config::file::section::Body::value_implicit()`]. + pub fn try_into_binary( + &'static self, + value: Option<std::borrow::Cow<'_, crate::bstr::BStr>>, + ) -> Result<Option<bool>, crate::config::key::GenericErrorWithValue> { + Ok(match value { + None => Some(true), + Some(value) => { + if value.as_ref() == "auto" { + None + } else { + Some( + gix_config::Boolean::try_from(value.as_ref()) + .map(|b| b.0) + .map_err(|err| { + crate::config::key::GenericErrorWithValue::from_value(self, value.into_owned()) + .with_source(err) + })?, + ) + } + } + }) + } + } +} + mod renames { use crate::{ bstr::ByteSlice, @@ -125,4 +187,12 @@ mod validate { Ok(()) } } + + pub struct Binary; + impl keys::Validate for Binary { + fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> { + Diff::DRIVER_BINARY.try_into_binary(Some(value.into()))?; + Ok(()) + } + } } diff --git a/vendor/gix/src/config/tree/sections/fetch.rs b/vendor/gix/src/config/tree/sections/fetch.rs index 32db7be5f..9b618913d 100644 --- a/vendor/gix/src/config/tree/sections/fetch.rs +++ b/vendor/gix/src/config/tree/sections/fetch.rs @@ -45,8 +45,7 @@ mod algorithm { &'static self, name: std::borrow::Cow<'_, crate::bstr::BStr>, ) -> Result<crate::remote::fetch::negotiate::Algorithm, crate::config::key::GenericErrorWithValue> { - use crate::bstr::ByteSlice; - use crate::remote::fetch::negotiate::Algorithm; + use crate::{bstr::ByteSlice, remote::fetch::negotiate::Algorithm}; Ok(match name.as_ref().as_bytes() { b"noop" => Algorithm::Noop, diff --git a/vendor/gix/src/config/tree/sections/gitoxide.rs b/vendor/gix/src/config/tree/sections/gitoxide.rs index 966d5af7c..a3b054412 100644 --- a/vendor/gix/src/config/tree/sections/gitoxide.rs +++ b/vendor/gix/src/config/tree/sections/gitoxide.rs @@ -14,6 +14,8 @@ impl Gitoxide { pub const COMMIT: Commit = Commit; /// The `gitoxide.committer` section. pub const COMMITTER: Committer = Committer; + /// The `gitoxide.credentials` section. + pub const CREDENTIALS: Credentials = Credentials; /// The `gitoxide.http` section. pub const HTTP: Http = Http; /// The `gitoxide.https` section. @@ -31,6 +33,9 @@ impl Gitoxide { pub const USER_AGENT: keys::Any = keys::Any::new("userAgent", &config::Tree::GITOXIDE).with_note( "The user agent presented on the git protocol layer, serving as fallback for when no `http.userAgent` is set", ); + /// The `gitoxide.tracePacket` Key. + pub const TRACE_PACKET: keys::Boolean = keys::Boolean::new_boolean("tracePacket", &config::Tree::GITOXIDE) + .with_environment_override("GIT_TRACE_PACKET"); } impl Section for Gitoxide { @@ -39,7 +44,7 @@ impl Section for Gitoxide { } fn keys(&self) -> &[&dyn Key] { - &[&Self::USER_AGENT] + &[&Self::USER_AGENT, &Self::TRACE_PACKET] } fn sub_sections(&self) -> &[&dyn Section] { @@ -49,6 +54,7 @@ impl Section for Gitoxide { &Self::CORE, &Self::COMMIT, &Self::COMMITTER, + &Self::CREDENTIALS, &Self::HTTP, &Self::HTTPS, &Self::OBJECTS, @@ -69,6 +75,20 @@ mod subsections { #[derive(Copy, Clone, Default)] pub struct Core; + /// The `gitoxide.allow.protocolFromUser` key. + pub type RefsNamespace = keys::Any<super::validate::RefsNamespace>; + + impl RefsNamespace { + /// Derive the negotiation algorithm identified by `name`, case-sensitively. + pub fn try_into_refs_namespace( + &'static self, + name: std::borrow::Cow<'_, crate::bstr::BStr>, + ) -> Result<gix_ref::Namespace, crate::config::refs_namespace::Error> { + gix_ref::namespace::expand(name.as_ref()) + .map_err(|err| crate::config::key::Error::from_value(self, name.into_owned()).with_source(err)) + } + } + impl Core { /// The `gitoxide.core.defaultPackCacheMemoryLimit` key. pub const DEFAULT_PACK_CACHE_MEMORY_LIMIT: keys::UnsignedInteger = @@ -95,6 +115,20 @@ mod subsections { /// It controls whether or not long running filter driver processes can use the 'delay' capability. pub const FILTER_PROCESS_DELAY: keys::Boolean = keys::Boolean::new_boolean("filterProcessDelay", &Gitoxide::CORE); + + /// The `gitoxide.core.externalCommandStderr` key (default `true`). + /// + /// If `true`, the default, `stderr` of worktree filter programs, or any other git-context bearing command + /// invoked will be inherited. + /// If `false`, it will be suppressed completely. + pub const EXTERNAL_COMMAND_STDERR: keys::Boolean = + keys::Boolean::new_boolean("externalCommandStderr", &Gitoxide::CORE) + .with_environment_override("GIX_EXTERNAL_COMMAND_STDERR"); + + /// The `gitoxide.core.refsNamespace` key. + pub const REFS_NAMESPACE: RefsNamespace = + keys::Any::new_with_validate("refsNamespace", &Gitoxide::CORE, super::validate::RefsNamespace) + .with_environment_override("GIT_NAMESPACE"); } impl Section for Core { @@ -109,6 +143,8 @@ mod subsections { &Self::USE_STDEV, &Self::SHALLOW_FILE, &Self::FILTER_PROCESS_DELAY, + &Self::EXTERNAL_COMMAND_STDERR, + &Self::REFS_NAMESPACE, ] } @@ -154,6 +190,14 @@ mod subsections { http::SslVersion::new_ssl_version("sslVersionMax", &Gitoxide::HTTP).with_note( "entirely new to set the upper bound for the allowed ssl version range. Overwrites the max bound of `http.sslVersion` if set. Min and Max must be set to become effective.", ); + /// The `gitoxide.http.sslNoVerify` key. + /// + /// If set, disable SSL verification. Using this is discouraged as it can lead to + /// various security risks. An example where this may be needed is when an internal + /// git server uses a self-signed certificate and the user accepts the associated security risks. + pub const SSL_NO_VERIFY: keys::Boolean = keys::Boolean::new_boolean("sslNoVerify", &Gitoxide::HTTP) + .with_environment_override("GIT_SSL_NO_VERIFY") + .with_note("used to disable SSL verification. When this is enabled it takes priority over http.sslVerify"); /// The `gitoxide.http.proxyAuthMethod` key. pub const PROXY_AUTH_METHOD: http::ProxyAuthMethod = http::ProxyAuthMethod::new_proxy_auth_method("proxyAuthMethod", &Gitoxide::HTTP) @@ -174,6 +218,7 @@ mod subsections { &Self::CONNECT_TIMEOUT, &Self::SSL_VERSION_MIN, &Self::SSL_VERSION_MAX, + &Self::SSL_NO_VERIFY, &Self::PROXY_AUTH_METHOD, ] } @@ -375,7 +420,7 @@ mod subsections { pub const CACHE_LIMIT: keys::UnsignedInteger = keys::UnsignedInteger::new_unsigned_integer("cacheLimit", &Gitoxide::OBJECTS) .with_note("If unset or 0, there is no object cache") - .with_environment_override("GITOXIDE_OBJECT_CACHE_MEMORY"); + .with_environment_override("GIX_OBJECT_CACHE_MEMORY"); /// The `gitoxide.objects.noReplace` key. pub const NO_REPLACE: keys::Boolean = keys::Boolean::new_boolean("noReplace", &Gitoxide::OBJECTS); /// The `gitoxide.objects.replaceRefBase` key. @@ -424,6 +469,37 @@ mod subsections { } } + /// The `credentials` sub-section. + #[derive(Copy, Clone, Default)] + pub struct Credentials; + impl Credentials { + /// The `gitoxide.credentials.terminalPrompt` key. + pub const TERMINAL_PROMPT: keys::Boolean = keys::Boolean::new_boolean("terminalPrompt", &Gitoxide::CREDENTIALS) + .with_note("This is a custom addition to provide an alternative to the respective environment variable.") + .with_environment_override("GIT_TERMINAL_PROMPT"); + + /// The `gitoxide.credentials.helperStderr` key to control what happens with the credential helpers `stderr`. + /// + /// If `true`, the default, `stderr` of credential helper programs will be inherited, just like with `git`. + /// If `false`, will be suppressed completely. + pub const HELPER_STDERR: keys::Boolean = keys::Boolean::new_boolean("helperStderr", &Gitoxide::CREDENTIALS) + .with_environment_override("GIX_CREDENTIALS_HELPER_STDERR"); + } + + impl Section for Credentials { + fn name(&self) -> &str { + "credentials" + } + + fn keys(&self) -> &[&dyn Key] { + &[&Self::TERMINAL_PROMPT, &Self::HELPER_STDERR] + } + + fn parent(&self) -> Option<&dyn Section> { + Some(&Tree::GITOXIDE) + } + } + /// The `commit` sub-section. #[derive(Copy, Clone, Default)] pub struct Commit; @@ -451,7 +527,7 @@ mod subsections { } } } -pub use subsections::{Allow, Author, Commit, Committer, Core, Http, Https, Objects, Pathspec, Ssh, User}; +pub use subsections::{Allow, Author, Commit, Committer, Core, Credentials, Http, Https, Objects, Pathspec, Ssh, User}; pub mod validate { use std::error::Error; @@ -467,4 +543,12 @@ pub mod validate { Ok(()) } } + + pub struct RefsNamespace; + impl Validate for RefsNamespace { + fn validate(&self, value: &BStr) -> Result<(), Box<dyn Error + Send + Sync + 'static>> { + super::Core::REFS_NAMESPACE.try_into_refs_namespace(value.into())?; + Ok(()) + } + } } diff --git a/vendor/gix/src/config/tree/sections/http.rs b/vendor/gix/src/config/tree/sections/http.rs index f45c37076..4fc733564 100644 --- a/vendor/gix/src/config/tree/sections/http.rs +++ b/vendor/gix/src/config/tree/sections/http.rs @@ -10,6 +10,9 @@ impl Http { .with_deviation( "accepts the new 'default' value which means to use the curl default just like the empty string does", ); + /// The `http.sslVerify` key. + pub const SSL_VERIFY: keys::Boolean = keys::Boolean::new_boolean("sslVerify", &config::Tree::HTTP) + .with_note("also see the `gitoxide.http.sslNoVerify` key"); /// The `http.proxy` key. pub const PROXY: keys::String = keys::String::new_string("proxy", &config::Tree::HTTP).with_deviation("fails on strings with illformed UTF-8"); @@ -58,6 +61,7 @@ impl Section for Http { fn keys(&self) -> &[&dyn Key] { &[ &Self::SSL_VERSION, + &Self::SSL_VERIFY, &Self::PROXY, &Self::PROXY_AUTH_METHOD, &Self::VERSION, |