Skip to content

Commit

Permalink
Add config section for mailmap.{blob,file}.
Browse files Browse the repository at this point in the history
These keys are not used at the moment, but will be introduced
as part of the work performed under Byron#1125.
  • Loading branch information
bittrance committed Dec 9, 2023
1 parent 281fda0 commit 86c7fa1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gix/src/config/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub(crate) mod root {
pub const INDEX: sections::Index = sections::Index;
/// The `init` section.
pub const INIT: sections::Init = sections::Init;
/// The `mailmap` section.
pub const MAILMAP: sections::Mailmap = sections::Mailmap;
/// The `pack` section.
pub const PACK: sections::Pack = sections::Pack;
/// The `protocol` section.
Expand Down Expand Up @@ -78,6 +80,7 @@ pub(crate) mod root {
&Self::HTTP,
&Self::INDEX,
&Self::INIT,
&Self::MAILMAP,
&Self::PACK,
&Self::PROTOCOL,
&Self::REMOTE,
Expand All @@ -93,8 +96,8 @@ pub(crate) mod root {
mod sections;
pub use sections::{
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,
Branch, Checkout, Clone, Committer, Core, Credential, Extensions, Fetch, Gitoxide, Http, Index, Init, Mailmap,
Pack, Protocol, Remote, Safe, Ssh, Url, User,
};
#[cfg(feature = "blob-diff")]
pub use sections::{diff, Diff};
Expand Down
21 changes: 21 additions & 0 deletions gix/src/config/tree/sections/mailmap.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::config::{
tree::{keys, Key, Mailmap, Section},
Tree,
};

impl Mailmap {
/// The `mailmap.blob` key
pub const BLOB: keys::Any = keys::Any::new("blob", &Tree::MAILMAP);
/// The `mailmap.file` key
pub const FILE: keys::Any = keys::Any::new("file", &Tree::MAILMAP);
}

impl Section for Mailmap {
fn name(&self) -> &str {
"mailmap"
}

fn keys(&self) -> &[&dyn Key] {
&[&Self::BLOB, &Self::FILE]
}
}
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 @@ -72,6 +72,10 @@ pub mod index;
pub struct Init;
mod init;

#[derive(Copy, Clone, Default)]
pub struct Mailmap;
mod mailmap;

/// The `pack` top-level section.
#[derive(Copy, Clone, Default)]
pub struct Pack;
Expand Down

0 comments on commit 86c7fa1

Please sign in to comment.