From e0b09d2764fd02a2b69340d9b3aef9773ae899ce Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 Sep 2024 15:12:34 +0200 Subject: [PATCH] add all keys for merge-configuration --- gix/src/config/tree/mod.rs | 5 +++- gix/src/config/tree/sections/merge.rs | 38 +++++++++++++++++++++++++++ gix/src/config/tree/sections/mod.rs | 4 +++ src/plumbing/progress.rs | 4 --- 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 gix/src/config/tree/sections/merge.rs diff --git a/gix/src/config/tree/mod.rs b/gix/src/config/tree/mod.rs index 0c9ccb01dbe..373c14c7879 100644 --- a/gix/src/config/tree/mod.rs +++ b/gix/src/config/tree/mod.rs @@ -47,6 +47,8 @@ pub(crate) mod root { pub const INIT: sections::Init = sections::Init; /// The `mailmap` section. pub const MAILMAP: sections::Mailmap = sections::Mailmap; + /// The `merge` section. + pub const MERGE: sections::Merge = sections::Merge; /// The `pack` section. pub const PACK: sections::Pack = sections::Pack; /// The `protocol` section. @@ -86,6 +88,7 @@ pub(crate) mod root { &Self::INDEX, &Self::INIT, &Self::MAILMAP, + &Self::MERGE, &Self::PACK, &Self::PROTOCOL, &Self::PUSH, @@ -105,7 +108,7 @@ mod sections; pub use sections::{ branch, checkout, core, credential, extensions, fetch, gitoxide, http, index, protocol, push, remote, ssh, Author, Branch, Checkout, Clone, Committer, Core, Credential, Extensions, Fetch, Gitoxide, Http, Index, Init, Mailmap, - Pack, Protocol, Push, Remote, Safe, Ssh, Url, User, + Merge, Pack, Protocol, Push, Remote, Safe, Ssh, Url, User, }; #[cfg(feature = "blob-diff")] pub use sections::{diff, Diff}; diff --git a/gix/src/config/tree/sections/merge.rs b/gix/src/config/tree/sections/merge.rs new file mode 100644 index 00000000000..5c43d7b772d --- /dev/null +++ b/gix/src/config/tree/sections/merge.rs @@ -0,0 +1,38 @@ +use crate::config; +use crate::config::tree::SubSectionRequirement; +use crate::config::{ + tree::{keys, Key, Merge, Section}, + Tree, +}; + +impl Merge { + /// The `merge.renormalize` key + pub const RENORMALIZE: keys::Boolean = keys::Boolean::new_boolean("renormalize", &Tree::MERGE); + /// The `merge.default` key + pub const DEFAULT: keys::String = keys::String::new_string("default", &Tree::MERGE); + /// The `merge..name` key. + pub const DRIVER_NAME: keys::String = keys::String::new_string("name", &config::Tree::MERGE) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); + /// The `merge..driver` key. + pub const DRIVER_COMMAND: keys::Program = keys::Program::new_program("driver", &config::Tree::MERGE) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); + /// The `merge..recursive` key. + pub const DRIVER_RECURSIVE: keys::String = keys::String::new_string("recursive", &config::Tree::MERGE) + .with_subsection_requirement(Some(SubSectionRequirement::Parameter("driver"))); +} + +impl Section for Merge { + fn name(&self) -> &str { + "merge" + } + + fn keys(&self) -> &[&dyn Key] { + &[ + &Self::RENORMALIZE, + &Self::DEFAULT, + &Self::DRIVER_NAME, + &Self::DRIVER_COMMAND, + &Self::DRIVER_RECURSIVE, + ] + } +} diff --git a/gix/src/config/tree/sections/mod.rs b/gix/src/config/tree/sections/mod.rs index ab2b9542a2c..e4e8db0773f 100644 --- a/gix/src/config/tree/sections/mod.rs +++ b/gix/src/config/tree/sections/mod.rs @@ -76,6 +76,10 @@ mod init; pub struct Mailmap; mod mailmap; +#[derive(Copy, Clone, Default)] +pub struct Merge; +mod merge; + /// The `pack` top-level section. #[derive(Copy, Clone, Default)] pub struct Pack; diff --git a/src/plumbing/progress.rs b/src/plumbing/progress.rs index e0e9e15aece..846837694f8 100644 --- a/src/plumbing/progress.rs +++ b/src/plumbing/progress.rs @@ -146,10 +146,6 @@ static GIT_CONFIG: &[Record] = &[ config: "index.sparse", usage: Planned("We can read sparse indices and support for it will be added early on") }, - Record { - config: "merge.renormalize", - usage: Planned("Once merging is being implemented, renormalization should be respected") - }, Record { config: "sparse.expectFilesOutsideOfPatterns", usage: Planned("A feature definitely worth having")