summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/config/tree
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix/src/config/tree')
-rw-r--r--vendor/gix/src/config/tree/keys.rs2
-rw-r--r--vendor/gix/src/config/tree/mod.rs8
-rw-r--r--vendor/gix/src/config/tree/sections/core.rs249
-rw-r--r--vendor/gix/src/config/tree/sections/diff.rs21
-rw-r--r--vendor/gix/src/config/tree/sections/fetch.rs81
-rw-r--r--vendor/gix/src/config/tree/sections/gitoxide.rs62
-rw-r--r--vendor/gix/src/config/tree/sections/index.rs5
-rw-r--r--vendor/gix/src/config/tree/sections/mod.rs2
-rw-r--r--vendor/gix/src/config/tree/sections/protocol.rs2
9 files changed, 372 insertions, 60 deletions
diff --git a/vendor/gix/src/config/tree/keys.rs b/vendor/gix/src/config/tree/keys.rs
index b03fa49c6..5a5257af5 100644
--- a/vendor/gix/src/config/tree/keys.rs
+++ b/vendor/gix/src/config/tree/keys.rs
@@ -464,7 +464,7 @@ mod remote_name {
}
}
-/// Provide a way to validate a value, or decode a value from `gix-config`.
+/// Provide a way to validate a value, or decode a value from `git-config`.
pub trait Validate {
/// Validate `value` or return an error.
fn validate(&self, value: &BStr) -> Result<(), Box<dyn Error + Send + Sync + 'static>>;
diff --git a/vendor/gix/src/config/tree/mod.rs b/vendor/gix/src/config/tree/mod.rs
index 3f69ccb97..d8415154f 100644
--- a/vendor/gix/src/config/tree/mod.rs
+++ b/vendor/gix/src/config/tree/mod.rs
@@ -31,6 +31,7 @@ pub(crate) mod root {
/// The `credential` section.
pub const CREDENTIAL: sections::Credential = sections::Credential;
/// The `diff` section.
+ #[cfg(feature = "blob-diff")]
pub const DIFF: sections::Diff = sections::Diff;
/// The `extensions` section.
pub const EXTENSIONS: sections::Extensions = sections::Extensions;
@@ -69,6 +70,7 @@ pub(crate) mod root {
&Self::COMMITTER,
&Self::CORE,
&Self::CREDENTIAL,
+ #[cfg(feature = "blob-diff")]
&Self::DIFF,
&Self::EXTENSIONS,
&Self::FETCH,
@@ -90,10 +92,12 @@ pub(crate) mod root {
mod sections;
pub use sections::{
- branch, checkout, core, credential, diff, extensions, fetch, gitoxide, http, index, protocol, remote, ssh, Author,
- Branch, Checkout, Clone, Committer, Core, Credential, Diff, Extensions, Fetch, Gitoxide, Http, Index, Init, Pack,
+ branch, checkout, core, credential, extensions, fetch, gitoxide, http, index, protocol, remote, ssh, Author,
+ Branch, Checkout, Clone, Committer, Core, Credential, Extensions, Fetch, Gitoxide, Http, Index, Init, Pack,
Protocol, Remote, Safe, Ssh, Url, User,
};
+#[cfg(feature = "blob-diff")]
+pub use sections::{diff, Diff};
/// Generic value implementations for static instantiation.
pub mod keys;
diff --git a/vendor/gix/src/config/tree/sections/core.rs b/vendor/gix/src/config/tree/sections/core.rs
index 93d2fcd01..ab3e2bab9 100644
--- a/vendor/gix/src/config/tree/sections/core.rs
+++ b/vendor/gix/src/config/tree/sections/core.rs
@@ -45,7 +45,8 @@ impl Core {
/// The `core.symlinks` key.
pub const SYMLINKS: keys::Boolean = keys::Boolean::new_boolean("symlinks", &config::Tree::CORE);
/// The `core.trustCTime` key.
- pub const TRUST_C_TIME: keys::Boolean = keys::Boolean::new_boolean("trustCTime", &config::Tree::CORE);
+ pub const TRUST_C_TIME: keys::Boolean = keys::Boolean::new_boolean("trustCTime", &config::Tree::CORE)
+ .with_deviation("Currently the default is false, instead of true, as it seems to be 2s off in tests");
/// The `core.worktree` key.
pub const WORKTREE: keys::Any = keys::Any::new("worktree", &config::Tree::CORE)
.with_environment_override("GIT_WORK_TREE")
@@ -66,6 +67,24 @@ impl Core {
/// The `core.useReplaceRefs` key.
pub const USE_REPLACE_REFS: keys::Boolean = keys::Boolean::new_boolean("useReplaceRefs", &config::Tree::CORE)
.with_environment_override("GIT_NO_REPLACE_OBJECTS");
+ /// The `core.commitGraph` key.
+ pub const COMMIT_GRAPH: keys::Boolean = keys::Boolean::new_boolean("commitGraph", &config::Tree::CORE);
+ /// The `core.safecrlf` key.
+ #[cfg(feature = "attributes")]
+ pub const SAFE_CRLF: SafeCrlf = SafeCrlf::new_with_validate("safecrlf", &config::Tree::CORE, validate::SafeCrlf);
+ /// The `core.autocrlf` key.
+ #[cfg(feature = "attributes")]
+ pub const AUTO_CRLF: AutoCrlf = AutoCrlf::new_with_validate("autocrlf", &config::Tree::CORE, validate::AutoCrlf);
+ /// The `core.eol` key.
+ #[cfg(feature = "attributes")]
+ pub const EOL: Eol = Eol::new_with_validate("eol", &config::Tree::CORE, validate::Eol);
+ /// The `core.checkRoundTripEncoding` key.
+ #[cfg(feature = "attributes")]
+ pub const CHECK_ROUND_TRIP_ENCODING: CheckRoundTripEncoding = CheckRoundTripEncoding::new_with_validate(
+ "checkRoundTripEncoding",
+ &config::Tree::CORE,
+ validate::CheckRoundTripEncoding,
+ );
}
impl Section for Core {
@@ -96,6 +115,15 @@ impl Section for Core {
&Self::ATTRIBUTES_FILE,
&Self::SSH_COMMAND,
&Self::USE_REPLACE_REFS,
+ &Self::COMMIT_GRAPH,
+ #[cfg(feature = "attributes")]
+ &Self::SAFE_CRLF,
+ #[cfg(feature = "attributes")]
+ &Self::AUTO_CRLF,
+ #[cfg(feature = "attributes")]
+ &Self::EOL,
+ #[cfg(feature = "attributes")]
+ &Self::CHECK_ROUND_TRIP_ENCODING,
]
}
}
@@ -112,6 +140,154 @@ pub type LogAllRefUpdates = keys::Any<validate::LogAllRefUpdates>;
/// The `core.disambiguate` key.
pub type Disambiguate = keys::Any<validate::Disambiguate>;
+#[cfg(feature = "attributes")]
+mod filter {
+ use super::validate;
+ use crate::config::tree::keys;
+
+ /// The `core.safecrlf` key.
+ pub type SafeCrlf = keys::Any<validate::SafeCrlf>;
+
+ /// The `core.autocrlf` key.
+ pub type AutoCrlf = keys::Any<validate::AutoCrlf>;
+
+ /// The `core.eol` key.
+ pub type Eol = keys::Any<validate::Eol>;
+
+ /// The `core.checkRoundTripEncoding` key.
+ pub type CheckRoundTripEncoding = keys::Any<validate::CheckRoundTripEncoding>;
+
+ mod check_round_trip_encoding {
+ use std::borrow::Cow;
+
+ use crate::{
+ bstr::{BStr, ByteSlice},
+ config,
+ config::tree::{core::CheckRoundTripEncoding, Key},
+ };
+
+ impl CheckRoundTripEncoding {
+ /// Convert `value` into a list of encodings, which are either space or coma separated. Fail if an encoding is unknown.
+ /// If `None`, the default is returned.
+ pub fn try_into_encodings(
+ &'static self,
+ value: Option<Cow<'_, BStr>>,
+ ) -> Result<Vec<&'static gix_filter::encoding::Encoding>, config::encoding::Error> {
+ Ok(match value {
+ None => vec![gix_filter::encoding::SHIFT_JIS],
+ Some(value) => {
+ let mut out = Vec::new();
+ for encoding in value
+ .as_ref()
+ .split(|b| *b == b',' || *b == b' ')
+ .filter(|e| !e.trim().is_empty())
+ {
+ out.push(
+ gix_filter::encoding::Encoding::for_label(encoding.trim()).ok_or_else(|| {
+ config::encoding::Error {
+ key: self.logical_name().into(),
+ value: value.as_ref().to_owned(),
+ encoding: encoding.into(),
+ }
+ })?,
+ );
+ }
+ out
+ }
+ })
+ }
+ }
+ }
+
+ mod eol {
+ use std::borrow::Cow;
+
+ use crate::{
+ bstr::{BStr, ByteSlice},
+ config,
+ config::tree::core::Eol,
+ };
+
+ impl Eol {
+ /// Convert `value` into the default end-of-line mode.
+ ///
+ /// ### Deviation
+ ///
+ /// git will allow any value and silently leaves it unset, we will fail if the value is not known.
+ pub fn try_into_eol(
+ &'static self,
+ value: Cow<'_, BStr>,
+ ) -> Result<gix_filter::eol::Mode, config::key::GenericErrorWithValue> {
+ Ok(match value.to_str_lossy().as_ref() {
+ "lf" => gix_filter::eol::Mode::Lf,
+ "crlf" => gix_filter::eol::Mode::CrLf,
+ "native" => gix_filter::eol::Mode::default(),
+ _ => return Err(config::key::GenericErrorWithValue::from_value(self, value.into_owned())),
+ })
+ }
+ }
+ }
+
+ mod safecrlf {
+ use std::borrow::Cow;
+
+ use gix_filter::pipeline::CrlfRoundTripCheck;
+
+ use crate::{bstr::BStr, config, config::tree::core::SafeCrlf};
+
+ impl SafeCrlf {
+ /// Convert `value` into the safe-crlf enumeration, if possible.
+ pub fn try_into_safecrlf(
+ &'static self,
+ value: Cow<'_, BStr>,
+ ) -> Result<CrlfRoundTripCheck, config::key::GenericErrorWithValue> {
+ if value.as_ref() == "warn" {
+ return Ok(CrlfRoundTripCheck::Warn);
+ }
+ let value = gix_config::Boolean::try_from(value.as_ref()).map_err(|err| {
+ config::key::GenericErrorWithValue::from_value(self, value.into_owned()).with_source(err)
+ })?;
+ Ok(if value.into() {
+ CrlfRoundTripCheck::Fail
+ } else {
+ CrlfRoundTripCheck::Skip
+ })
+ }
+ }
+ }
+
+ mod autocrlf {
+ use std::borrow::Cow;
+
+ use gix_filter::eol;
+
+ use crate::{bstr::BStr, config, config::tree::core::AutoCrlf};
+
+ impl AutoCrlf {
+ /// Convert `value` into the safe-crlf enumeration, if possible.
+ pub fn try_into_autocrlf(
+ &'static self,
+ value: Cow<'_, BStr>,
+ ) -> Result<eol::AutoCrlf, config::key::GenericErrorWithValue> {
+ if value.as_ref() == "input" {
+ return Ok(eol::AutoCrlf::Input);
+ }
+ let value = gix_config::Boolean::try_from(value.as_ref()).map_err(|err| {
+ config::key::GenericErrorWithValue::from_value(self, value.into_owned()).with_source(err)
+ })?;
+ Ok(if value.into() {
+ eol::AutoCrlf::Enabled
+ } else {
+ eol::AutoCrlf::Disabled
+ })
+ }
+ }
+ }
+}
+#[cfg(feature = "attributes")]
+pub use filter::*;
+
+#[cfg(feature = "revision")]
mod disambiguate {
use std::borrow::Cow;
@@ -143,30 +319,27 @@ mod disambiguate {
}
mod log_all_ref_updates {
- use std::borrow::Cow;
-
- use crate::{bstr::BStr, config, config::tree::core::LogAllRefUpdates};
+ use crate::{config, config::tree::core::LogAllRefUpdates};
impl LogAllRefUpdates {
- /// Returns the mode for ref-updates as parsed from `value`. If `value` is not a boolean, `string_on_failure` will be called
- /// to obtain the key `core.logAllRefUpdates` as string instead. For correctness, this two step process is necessary as
- /// the interpretation of booleans in special in `gix-config`, i.e. we can't just treat it as string.
- pub fn try_into_ref_updates<'a>(
+ /// Returns the mode for ref-updates as parsed from `value`. If `value` is not a boolean, we try
+ /// to interpret the string value instead. For correctness, this two step process is necessary as
+ /// the interpretation of booleans in special in `git-config`, i.e. we can't just treat it as string.
+ pub fn try_into_ref_updates(
&'static self,
value: Option<Result<bool, gix_config::value::Error>>,
- string_on_failure: impl FnOnce() -> Option<Cow<'a, BStr>>,
) -> Result<Option<gix_ref::store::WriteReflog>, config::key::GenericErrorWithValue> {
- match value.transpose().ok().flatten() {
- Some(bool) => Ok(Some(if bool {
+ match value {
+ Some(Ok(bool)) => Ok(Some(if bool {
gix_ref::store::WriteReflog::Normal
} else {
gix_ref::store::WriteReflog::Disable
})),
- None => match string_on_failure() {
- Some(val) if val.eq_ignore_ascii_case(b"always") => Ok(Some(gix_ref::store::WriteReflog::Always)),
- Some(val) => Err(config::key::GenericErrorWithValue::from_value(self, val.into_owned())),
- None => Ok(None),
+ Some(Err(err)) => match err.input {
+ val if val.eq_ignore_ascii_case(b"always") => Ok(Some(gix_ref::store::WriteReflog::Always)),
+ val => Err(config::key::GenericErrorWithValue::from_value(self, val)),
},
+ None => Ok(None),
}
}
}
@@ -270,7 +443,9 @@ mod validate {
pub struct Disambiguate;
impl keys::Validate for Disambiguate {
+ #[cfg_attr(not(feature = "revision"), allow(unused_variables))]
fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ #[cfg(feature = "revision")]
super::Core::DISAMBIGUATE.try_into_object_kind_hint(value.into())?;
Ok(())
}
@@ -280,9 +455,7 @@ mod validate {
impl keys::Validate for LogAllRefUpdates {
fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
super::Core::LOG_ALL_REF_UPDATES
- .try_into_ref_updates(Some(gix_config::Boolean::try_from(value).map(|b| b.0)), || {
- Some(value.into())
- })?;
+ .try_into_ref_updates(Some(gix_config::Boolean::try_from(value).map(|b| b.0)))?;
Ok(())
}
}
@@ -303,4 +476,44 @@ mod validate {
Ok(())
}
}
+
+ pub struct SafeCrlf;
+ impl keys::Validate for SafeCrlf {
+ #[cfg_attr(not(feature = "attributes"), allow(unused_variables))]
+ fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ #[cfg(feature = "attributes")]
+ super::Core::SAFE_CRLF.try_into_safecrlf(value.into())?;
+ Ok(())
+ }
+ }
+
+ pub struct AutoCrlf;
+ impl keys::Validate for AutoCrlf {
+ #[cfg_attr(not(feature = "attributes"), allow(unused_variables))]
+ fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ #[cfg(feature = "attributes")]
+ super::Core::AUTO_CRLF.try_into_autocrlf(value.into())?;
+ Ok(())
+ }
+ }
+
+ pub struct Eol;
+ impl keys::Validate for Eol {
+ #[cfg_attr(not(feature = "attributes"), allow(unused_variables))]
+ fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ #[cfg(feature = "attributes")]
+ super::Core::EOL.try_into_eol(value.into())?;
+ Ok(())
+ }
+ }
+
+ pub struct CheckRoundTripEncoding;
+ impl keys::Validate for CheckRoundTripEncoding {
+ #[cfg_attr(not(feature = "attributes"), allow(unused_variables))]
+ fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ #[cfg(feature = "attributes")]
+ super::Core::CHECK_ROUND_TRIP_ENCODING.try_into_encodings(Some(value.into()))?;
+ Ok(())
+ }
+ }
}
diff --git a/vendor/gix/src/config/tree/sections/diff.rs b/vendor/gix/src/config/tree/sections/diff.rs
index 103bb7001..7c467b8f5 100644
--- a/vendor/gix/src/config/tree/sections/diff.rs
+++ b/vendor/gix/src/config/tree/sections/diff.rs
@@ -68,10 +68,8 @@ mod algorithm {
}
mod renames {
- use std::borrow::Cow;
-
use crate::{
- bstr::{BStr, ByteSlice},
+ bstr::ByteSlice,
config::{
key::GenericError,
tree::{keys, sections::diff::Renames, Section},
@@ -84,21 +82,20 @@ mod renames {
pub const fn new_renames(name: &'static str, section: &'static dyn Section) -> Self {
keys::Any::new_with_validate(name, section, super::validate::Renames)
}
- /// Try to convert the configuration into a valid rename tracking variant. Use `value` and if it's an error, call `value_string`
- /// to try and interpret the key as string.
- pub fn try_into_renames<'a>(
+ /// Try to convert the configuration into a valid rename tracking variant. Use `value` and if it's an error, interpret
+ /// the boolean as string
+ pub fn try_into_renames(
&'static self,
value: Result<bool, gix_config::value::Error>,
- value_string: impl FnOnce() -> Option<Cow<'a, BStr>>,
) -> Result<Tracking, GenericError> {
Ok(match value {
Ok(true) => Tracking::Renames,
Ok(false) => Tracking::Disabled,
Err(err) => {
- let value = value_string().ok_or_else(|| GenericError::from(self))?;
- match value.as_ref().as_bytes() {
+ let value = &err.input;
+ match value.as_bytes() {
b"copy" | b"copies" => Tracking::RenamesAndCopies,
- _ => return Err(GenericError::from_value(self, value.into_owned()).with_source(err)),
+ _ => return Err(GenericError::from_value(self, value.clone()).with_source(err)),
}
}
})
@@ -107,8 +104,6 @@ mod renames {
}
mod validate {
- use std::borrow::Cow;
-
use crate::{
bstr::BStr,
config::tree::{keys, Diff},
@@ -126,7 +121,7 @@ mod validate {
impl keys::Validate for Renames {
fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let boolean = gix_config::Boolean::try_from(value).map(|b| b.0);
- Diff::RENAMES.try_into_renames(boolean, || Some(Cow::Borrowed(value)))?;
+ Diff::RENAMES.try_into_renames(boolean)?;
Ok(())
}
}
diff --git a/vendor/gix/src/config/tree/sections/fetch.rs b/vendor/gix/src/config/tree/sections/fetch.rs
index 117cabfd2..32db7be5f 100644
--- a/vendor/gix/src/config/tree/sections/fetch.rs
+++ b/vendor/gix/src/config/tree/sections/fetch.rs
@@ -10,6 +10,10 @@ impl Fetch {
&config::Tree::FETCH,
validate::NegotiationAlgorithm,
);
+ /// The `fetch.recurseSubmodules` key.
+ #[cfg(feature = "attributes")]
+ pub const RECURSE_SUBMODULES: RecurseSubmodules =
+ RecurseSubmodules::new_with_validate("recurseSubmodules", &config::Tree::FETCH, validate::RecurseSubmodules);
}
impl Section for Fetch {
@@ -18,50 +22,81 @@ impl Section for Fetch {
}
fn keys(&self) -> &[&dyn Key] {
- &[&Self::NEGOTIATION_ALGORITHM]
+ &[
+ &Self::NEGOTIATION_ALGORITHM,
+ #[cfg(feature = "attributes")]
+ &Self::RECURSE_SUBMODULES,
+ ]
}
}
/// The `fetch.negotiationAlgorithm` key.
pub type NegotiationAlgorithm = keys::Any<validate::NegotiationAlgorithm>;
-mod algorithm {
- use std::borrow::Cow;
-
- use gix_object::bstr::ByteSlice;
+/// The `fetch.recurseSubmodules` key.
+#[cfg(feature = "attributes")]
+pub type RecurseSubmodules = keys::Any<validate::RecurseSubmodules>;
- use crate::{
- bstr::BStr,
- config::{key::GenericErrorWithValue, tree::sections::fetch::NegotiationAlgorithm},
- remote::fetch::negotiate,
- };
-
- impl NegotiationAlgorithm {
+mod algorithm {
+ #[cfg(feature = "credentials")]
+ impl crate::config::tree::sections::fetch::NegotiationAlgorithm {
/// Derive the negotiation algorithm identified by `name`, case-sensitively.
pub fn try_into_negotiation_algorithm(
&'static self,
- name: Cow<'_, BStr>,
- ) -> Result<negotiate::Algorithm, GenericErrorWithValue> {
+ 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;
+
Ok(match name.as_ref().as_bytes() {
- b"noop" => negotiate::Algorithm::Noop,
- b"consecutive" | b"default" => negotiate::Algorithm::Consecutive,
- b"skipping" => negotiate::Algorithm::Skipping,
- _ => return Err(GenericErrorWithValue::from_value(self, name.into_owned())),
+ b"noop" => Algorithm::Noop,
+ b"consecutive" | b"default" => Algorithm::Consecutive,
+ b"skipping" => Algorithm::Skipping,
+ _ => {
+ return Err(crate::config::key::GenericErrorWithValue::from_value(
+ self,
+ name.into_owned(),
+ ))
+ }
})
}
}
+
+ #[cfg(feature = "attributes")]
+ impl crate::config::tree::sections::fetch::RecurseSubmodules {
+ /// Obtain the way submodules should be updated.
+ pub fn try_into_recurse_submodules(
+ &'static self,
+ value: Result<bool, gix_config::value::Error>,
+ ) -> Result<gix_submodule::config::FetchRecurse, crate::config::key::GenericErrorWithValue> {
+ gix_submodule::config::FetchRecurse::new(value)
+ .map_err(|err| crate::config::key::GenericErrorWithValue::from_value(self, err))
+ }
+ }
}
mod validate {
- use crate::{
- bstr::BStr,
- config::tree::{keys, Fetch},
- };
+ use crate::{bstr::BStr, config::tree::keys};
pub struct NegotiationAlgorithm;
impl keys::Validate for NegotiationAlgorithm {
+ #[cfg_attr(not(feature = "credentials"), allow(unused_variables))]
+ fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ #[cfg(feature = "credentials")]
+ crate::config::tree::Fetch::NEGOTIATION_ALGORITHM.try_into_negotiation_algorithm(value.into())?;
+ Ok(())
+ }
+ }
+
+ pub struct RecurseSubmodules;
+ impl keys::Validate for RecurseSubmodules {
+ #[cfg_attr(not(feature = "attributes"), allow(unused_variables))]
fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
- Fetch::NEGOTIATION_ALGORITHM.try_into_negotiation_algorithm(value.into())?;
+ #[cfg(feature = "attributes")]
+ {
+ let boolean = gix_config::Boolean::try_from(value).map(|b| b.0);
+ crate::config::tree::Fetch::RECURSE_SUBMODULES.try_into_recurse_submodules(boolean)?;
+ }
Ok(())
}
}
diff --git a/vendor/gix/src/config/tree/sections/gitoxide.rs b/vendor/gix/src/config/tree/sections/gitoxide.rs
index f07d494fb..966d5af7c 100644
--- a/vendor/gix/src/config/tree/sections/gitoxide.rs
+++ b/vendor/gix/src/config/tree/sections/gitoxide.rs
@@ -24,6 +24,8 @@ impl Gitoxide {
pub const SSH: Ssh = Ssh;
/// The `gitoxide.user` section.
pub const USER: User = User;
+ /// The `gitoxide.pathspec` section.
+ pub const PATHSPEC: Pathspec = Pathspec;
/// The `gitoxide.userAgent` Key.
pub const USER_AGENT: keys::Any = keys::Any::new("userAgent", &config::Tree::GITOXIDE).with_note(
@@ -52,6 +54,7 @@ impl Section for Gitoxide {
&Self::OBJECTS,
&Self::SSH,
&Self::USER,
+ &Self::PATHSPEC,
]
}
}
@@ -86,6 +89,12 @@ mod subsections {
.with_deviation(
"relative file paths will always be made relative to the git-common-dir, whereas `git` keeps them as is.",
);
+
+ /// The `gitoxide.core.filterProcessDelay` key (default `true`).
+ ///
+ /// 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);
}
impl Section for Core {
@@ -99,6 +108,7 @@ mod subsections {
&Self::USE_NSEC,
&Self::USE_STDEV,
&Self::SHALLOW_FILE,
+ &Self::FILTER_PROCESS_DELAY,
]
}
@@ -306,6 +316,56 @@ mod subsections {
}
}
+ /// The `pathspec` sub-section.
+ #[derive(Copy, Clone, Default)]
+ pub struct Pathspec;
+
+ impl Pathspec {
+ /// The `gitoxide.pathspec.glob` key.
+ pub const GLOB: keys::Boolean = keys::Boolean::new_boolean("glob", &Gitoxide::PATHSPEC)
+ .with_environment_override("GIT_GLOB_PATHSPECS")
+ .with_note("pathspec wildcards don't match the slash character, then needing '**' to get past them");
+ /// The `gitoxide.pathspec.noglob` key.
+ pub const NOGLOB: keys::Boolean = keys::Boolean::new_boolean("noglob", &Gitoxide::PATHSPEC)
+ .with_environment_override("GIT_NOGLOB_PATHSPECS")
+ .with_note("Enable literal matching for glob patterns, effectively disabling globbing");
+ /// The `gitoxide.pathspec.literal` key.
+ pub const LITERAL: keys::Boolean = keys::Boolean::new_boolean("literal", &Gitoxide::PATHSPEC)
+ .with_environment_override("GIT_LITERAL_PATHSPECS")
+ .with_note("Make the entire spec used verbatim, the only way to get ':()name' verbatim for instance");
+ /// The `gitoxide.pathspec.icase` key.
+ pub const ICASE: keys::Boolean = keys::Boolean::new_boolean("icase", &Gitoxide::PATHSPEC)
+ .with_environment_override("GIT_ICASE_PATHSPECS")
+ .with_note("Compare string in a case-insensitive manner");
+ /// The `gitoxide.pathspec.inheritIgnoreCase` key, defaulting to `true` if unspecified.
+ /// If set, pathspecs will automatically be match case-insensitively if the underlying filesystem is configured that way.
+ pub const INHERIT_IGNORE_CASE: keys::Boolean =
+ keys::Boolean::new_boolean("inheritIgnoreCase", &Gitoxide::PATHSPEC)
+ .with_note("Inherit `core.ignoreCase` for defaults in pathspecs");
+ /// The default value for `gitoxide.pathspec.inheritIgnoreCase`.
+ pub const INHERIT_IGNORE_CASE_DEFAULT: bool = true;
+ }
+
+ impl Section for Pathspec {
+ fn name(&self) -> &str {
+ "pathspec"
+ }
+
+ fn keys(&self) -> &[&dyn Key] {
+ &[
+ &Self::GLOB,
+ &Self::NOGLOB,
+ &Self::LITERAL,
+ &Self::ICASE,
+ &Self::INHERIT_IGNORE_CASE,
+ ]
+ }
+
+ fn parent(&self) -> Option<&dyn Section> {
+ Some(&Tree::GITOXIDE)
+ }
+ }
+
/// The `objects` sub-section.
#[derive(Copy, Clone, Default)]
pub struct Objects;
@@ -391,7 +451,7 @@ mod subsections {
}
}
}
-pub use subsections::{Allow, Author, Commit, Committer, Core, Http, Https, Objects, Ssh, User};
+pub use subsections::{Allow, Author, Commit, Committer, Core, Http, Https, Objects, Pathspec, Ssh, User};
pub mod validate {
use std::error::Error;
diff --git a/vendor/gix/src/config/tree/sections/index.rs b/vendor/gix/src/config/tree/sections/index.rs
index 08f7ec1bd..026f35b6d 100644
--- a/vendor/gix/src/config/tree/sections/index.rs
+++ b/vendor/gix/src/config/tree/sections/index.rs
@@ -7,6 +7,9 @@ impl Index {
/// The `index.threads` key.
pub const THREADS: IndexThreads =
IndexThreads::new_with_validate("threads", &config::Tree::INDEX, validate::IndexThreads);
+ /// The `index.skipHash` key.
+ pub const SKIP_HASH: keys::Boolean = keys::Boolean::new_boolean("skipHash", &config::Tree::INDEX)
+ .with_deviation("also used to skip the hash when reading, even if a hash exists in the index file");
}
/// The `index.threads` key.
@@ -47,7 +50,7 @@ impl Section for Index {
}
fn keys(&self) -> &[&dyn Key] {
- &[&Self::THREADS]
+ &[&Self::THREADS, &Self::SKIP_HASH]
}
}
diff --git a/vendor/gix/src/config/tree/sections/mod.rs b/vendor/gix/src/config/tree/sections/mod.rs
index ebf24a8b7..34929c5d1 100644
--- a/vendor/gix/src/config/tree/sections/mod.rs
+++ b/vendor/gix/src/config/tree/sections/mod.rs
@@ -37,7 +37,9 @@ pub mod credential;
/// The `diff` top-level section.
#[derive(Copy, Clone, Default)]
+#[cfg(feature = "blob-diff")]
pub struct Diff;
+#[cfg(feature = "blob-diff")]
pub mod diff;
/// The `extension` top-level section.
diff --git a/vendor/gix/src/config/tree/sections/protocol.rs b/vendor/gix/src/config/tree/sections/protocol.rs
index a0510f2b8..7ef2cc8cb 100644
--- a/vendor/gix/src/config/tree/sections/protocol.rs
+++ b/vendor/gix/src/config/tree/sections/protocol.rs
@@ -127,7 +127,7 @@ mod validate {
.to_decimal()
.ok_or_else(|| format!("integer {value} cannot be represented as integer"))?;
match value {
- 0 | 1 | 2 => Ok(()),
+ 0..=2 => Ok(()),
_ => Err(format!("protocol version {value} is unknown").into()),
}
}