git-ref-format: add QualifiedPattern and NamespacedPattern

There was no mechanism for building refspec patterns that included
namespaces.

To get around this limitation, QualifiedPattern and NamespacedPattern
are added to the refspec module.

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 b98c9aac03
commit 6479ba091f
4 changed files with 366 additions and 3 deletions
+8 -1
View File
@@ -6,7 +6,7 @@
use std::fmt::{self, Display};
use super::PatternStr;
use crate::RefStr;
use crate::{lit, RefStr};
pub type Iter<'a> = std::str::Split<'a, char>;
@@ -40,6 +40,13 @@ impl Display for Component<'_> {
}
}
impl<T: lit::Lit> From<T> for Component<'static> {
#[inline]
fn from(_: T) -> Self {
Self::Normal(T::NAME)
}
}
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[derive(Clone)]
pub struct Components<'a> {