summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/config/tree/sections
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix/src/config/tree/sections
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+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/clone.rs4
-rw-r--r--vendor/gix/src/config/tree/sections/gitoxide.rs48
-rw-r--r--vendor/gix/src/config/tree/sections/index.rs62
-rw-r--r--vendor/gix/src/config/tree/sections/mod.rs5
4 files changed, 113 insertions, 6 deletions
diff --git a/vendor/gix/src/config/tree/sections/clone.rs b/vendor/gix/src/config/tree/sections/clone.rs
index 616185a0b..6cb274e7d 100644
--- a/vendor/gix/src/config/tree/sections/clone.rs
+++ b/vendor/gix/src/config/tree/sections/clone.rs
@@ -7,6 +7,8 @@ impl Clone {
/// The `clone.defaultRemoteName` key.
pub const DEFAULT_REMOTE_NAME: keys::RemoteName =
keys::RemoteName::new_remote_name("defaultRemoteName", &config::Tree::CLONE);
+ /// The `clone.rejectShallow` key.
+ pub const REJECT_SHALLOW: keys::Boolean = keys::Boolean::new_boolean("rejectShallow", &config::Tree::CLONE);
}
impl Section for Clone {
@@ -15,6 +17,6 @@ impl Section for Clone {
}
fn keys(&self) -> &[&dyn Key] {
- &[&Self::DEFAULT_REMOTE_NAME]
+ &[&Self::DEFAULT_REMOTE_NAME, &Self::REJECT_SHALLOW]
}
}
diff --git a/vendor/gix/src/config/tree/sections/gitoxide.rs b/vendor/gix/src/config/tree/sections/gitoxide.rs
index 8c3defd0b..7d60f1287 100644
--- a/vendor/gix/src/config/tree/sections/gitoxide.rs
+++ b/vendor/gix/src/config/tree/sections/gitoxide.rs
@@ -1,10 +1,15 @@
-use crate::config::tree::{keys, Gitoxide, Key, Section};
+use crate::{
+ config,
+ config::tree::{keys, Gitoxide, Key, Section},
+};
impl Gitoxide {
/// The `gitoxide.allow` section.
pub const ALLOW: Allow = Allow;
/// The `gitoxide.author` section.
pub const AUTHOR: Author = Author;
+ /// The `gitoxide.core` section.
+ pub const CORE: Core = Core;
/// The `gitoxide.commit` section.
pub const COMMIT: Commit = Commit;
/// The `gitoxide.committer` section.
@@ -39,6 +44,7 @@ impl Section for Gitoxide {
&[
&Self::ALLOW,
&Self::AUTHOR,
+ &Self::CORE,
&Self::COMMIT,
&Self::COMMITTER,
&Self::HTTP,
@@ -56,6 +62,41 @@ mod subsections {
Tree,
};
+ /// The `Core` sub-section.
+ #[derive(Copy, Clone, Default)]
+ pub struct Core;
+
+ impl Core {
+ /// The `gitoxide.core.useNsec` key.
+ pub const USE_NSEC: keys::Boolean = keys::Boolean::new_boolean("useNsec", &Gitoxide::CORE)
+ .with_note("A runtime version of the USE_NSEC build flag.");
+
+ /// The `gitoxide.core.useStdev` key.
+ pub const USE_STDEV: keys::Boolean = keys::Boolean::new_boolean("useStdev", &Gitoxide::CORE)
+ .with_note("A runtime version of the USE_STDEV build flag.");
+
+ /// The `gitoxide.core.shallowFile` key.
+ pub const SHALLOW_FILE: keys::Path = keys::Path::new_path("shallowFile", &Gitoxide::CORE)
+ .with_environment_override("GIT_SHALLOW_FILE")
+ .with_deviation(
+ "relative file paths will always be made relative to the git-common-dir, whereas `git` keeps them as is.",
+ );
+ }
+
+ impl Section for Core {
+ fn name(&self) -> &str {
+ "core"
+ }
+
+ fn keys(&self) -> &[&dyn Key] {
+ &[&Self::USE_NSEC, &Self::USE_STDEV, &Self::SHALLOW_FILE]
+ }
+
+ fn parent(&self) -> Option<&dyn Section> {
+ Some(&Tree::GITOXIDE)
+ }
+ }
+
/// The `Http` sub-section.
#[derive(Copy, Clone, Default)]
pub struct Http;
@@ -341,6 +382,7 @@ mod subsections {
}
}
}
+pub use subsections::{Allow, Author, Commit, Committer, Core, Http, Https, Objects, Ssh, User};
pub mod validate {
use std::error::Error;
@@ -357,7 +399,3 @@ pub mod validate {
}
}
}
-
-pub use subsections::{Allow, Author, Commit, Committer, Http, Https, Objects, Ssh, User};
-
-use crate::config;
diff --git a/vendor/gix/src/config/tree/sections/index.rs b/vendor/gix/src/config/tree/sections/index.rs
new file mode 100644
index 000000000..d03322247
--- /dev/null
+++ b/vendor/gix/src/config/tree/sections/index.rs
@@ -0,0 +1,62 @@
+use crate::{
+ config,
+ config::tree::{keys, Index, Key, Section},
+};
+
+impl Index {
+ /// The `index.threads` key.
+ pub const THREADS: IndexThreads =
+ IndexThreads::new_with_validate("threads", &config::Tree::INDEX, validate::IndexThreads);
+}
+
+/// The `index.threads` key.
+pub type IndexThreads = keys::Any<validate::IndexThreads>;
+
+mod index_threads {
+ use crate::bstr::BStr;
+ use crate::config;
+ use crate::config::key::GenericErrorWithValue;
+ use crate::config::tree::index::IndexThreads;
+ use std::borrow::Cow;
+
+ impl IndexThreads {
+ /// Parse `value` into the amount of threads to use, with `1` being single-threaded, or `0` indicating
+ /// to select the amount of threads, with any other number being the specific amount of threads to use.
+ pub fn try_into_index_threads(
+ &'static self,
+ value: Cow<'_, BStr>,
+ ) -> Result<usize, config::key::GenericErrorWithValue> {
+ gix_config::Integer::try_from(value.as_ref())
+ .ok()
+ .and_then(|i| i.to_decimal().and_then(|i| i.try_into().ok()))
+ .or_else(|| {
+ gix_config::Boolean::try_from(value.as_ref())
+ .ok()
+ .map(|b| if b.0 { 0 } else { 1 })
+ })
+ .ok_or_else(|| GenericErrorWithValue::from_value(self, value.into_owned()))
+ }
+ }
+}
+
+impl Section for Index {
+ fn name(&self) -> &str {
+ "index"
+ }
+
+ fn keys(&self) -> &[&dyn Key] {
+ &[&Self::THREADS]
+ }
+}
+
+mod validate {
+ use crate::{bstr::BStr, config::tree::keys};
+
+ pub struct IndexThreads;
+ impl keys::Validate for IndexThreads {
+ fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
+ super::Index::THREADS.try_into_index_threads(value.into())?;
+ Ok(())
+ }
+ }
+}
diff --git a/vendor/gix/src/config/tree/sections/mod.rs b/vendor/gix/src/config/tree/sections/mod.rs
index fb9b50786..9f0a50c93 100644
--- a/vendor/gix/src/config/tree/sections/mod.rs
+++ b/vendor/gix/src/config/tree/sections/mod.rs
@@ -55,6 +55,11 @@ pub mod gitoxide;
pub struct Http;
pub mod http;
+/// The `index` top-level section.
+#[derive(Copy, Clone, Default)]
+pub struct Index;
+pub mod index;
+
/// The `init` top-level section.
#[derive(Copy, Clone, Default)]
pub struct Init;