Skip to content

Commit

Permalink
add all keys for merge-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Sep 30, 2024
1 parent b26eb26 commit e0b09d2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
5 changes: 4 additions & 1 deletion gix/src/config/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -86,6 +88,7 @@ pub(crate) mod root {
&Self::INDEX,
&Self::INIT,
&Self::MAILMAP,
&Self::MERGE,
&Self::PACK,
&Self::PROTOCOL,
&Self::PUSH,
Expand All @@ -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};
Expand Down
38 changes: 38 additions & 0 deletions gix/src/config/tree/sections/merge.rs
Original file line number Diff line number Diff line change
@@ -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.<driver>.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>.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.<driver>.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,
]
}
}
4 changes: 4 additions & 0 deletions gix/src/config/tree/sections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/plumbing/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e0b09d2

Please sign in to comment.