git-ref-format: add well-known refspec components

Add constants for well-known refspec component names.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2022-11-18 10:49:22 +00:00
parent a4fc3db933
commit 2b5a34a703
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ use thiserror::Error;
use crate::{check, lit, RefStr, RefString};
mod iter;
pub use iter::{Component, Components, Iter};
pub use iter::{component, Component, Components, Iter};
pub const STAR: &PatternStr = PatternStr::from_str("*");
+16
View File
@@ -85,3 +85,19 @@ impl<'a> From<&'a PatternStr> for Components<'a> {
}
}
}
pub mod component {
use super::Component;
use crate::name;
pub const STAR: Component = Component::Glob(None);
pub const HEADS: Component = Component::Normal(name::HEADS);
pub const MAIN: Component = Component::Normal(name::MAIN);
pub const MASTER: Component = Component::Normal(name::MASTER);
pub const NAMESPACES: Component = Component::Normal(name::NAMESPACES);
pub const NOTES: Component = Component::Normal(name::NOTES);
pub const ORIGIN: Component = Component::Normal(name::ORIGIN);
pub const REFS: Component = Component::Normal(name::REFS);
pub const REMOTES: Component = Component::Normal(name::REMOTES);
pub const TAGS: Component = Component::Normal(name::TAGS);
}