From a9525f2173b3379b60c18eefaaaa84ca742cd63b Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Sun, 18 Oct 2026 21:00:22 +0200 Subject: [PATCH] git-ref-format: Allow composing patterns --- crates/radicle-git-ref-format/src/refspec.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/radicle-git-ref-format/src/refspec.rs b/crates/radicle-git-ref-format/src/refspec.rs index 22f25d84a..26934d29d 100644 --- a/crates/radicle-git-ref-format/src/refspec.rs +++ b/crates/radicle-git-ref-format/src/refspec.rs @@ -39,12 +39,16 @@ impl PatternStr { where R: AsRef, { - self._join(other.as_ref()) + self._join(&other.as_ref()) } - fn _join(&self, other: &RefStr) -> PatternString { + pub fn join_pattern(&self, other: &PatternStr) -> PatternString { + self._join(&other) + } + + fn _join(&self, other: &impl AsRef) -> PatternString { let mut buf = self.to_owned(); - buf.push(other); + buf._push(other); buf } @@ -153,7 +157,7 @@ impl PatternString { where R: AsRef, { - self._push(other.as_ref()); + self._push(&other.as_ref()); self } @@ -162,12 +166,12 @@ impl PatternString { where R: AsRef, { - self._push(other.as_ref()) + self._push(&other.as_ref()) } - fn _push(&mut self, other: &RefStr) { + fn _push(&mut self, other: &impl AsRef) { self.0.push('/'); - self.0.push_str(other.as_str()); + self.0.push_str(other.as_ref()); } #[inline]