pub struct RefSpecRef<'a> { /* private fields */ }Expand description
A refspec with references to the memory it was parsed from.
Implementations§
Source§impl<'a> RefSpecRef<'a>
Access
impl<'a> RefSpecRef<'a>
Access
Sourcepub fn source(&self) -> Option<&BStr>
pub fn source(&self) -> Option<&BStr>
Return the left-hand side of the spec, typically the source. It takes many different forms so don’t rely on this being a ref name.
It’s not present in case of deletions.
Sourcepub fn destination(&self) -> Option<&BStr>
pub fn destination(&self) -> Option<&BStr>
Return the right-hand side of the spec, typically the destination ref name or ref pattern.
It’s not present in case of source-only specs.
Sourcepub fn remote(&self) -> Option<&BStr>
pub fn remote(&self) -> Option<&BStr>
Return the explicitly stored remote side, whose position depends on how the refspec was parsed.
A one-sided push refspec has no explicit remote side and returns None here, even though its source
is later also used as its destination.
Sourcepub fn local(&self) -> Option<&BStr>
pub fn local(&self) -> Option<&BStr>
Return the explicitly stored local side, whose position depends on how the refspec was parsed.
Sourcepub fn prefix(&self) -> Option<&BStr>
pub fn prefix(&self) -> Option<&BStr>
Derive the prefix from the source side of this spec if this is a fetch spec,
or the destination side if it is a push spec, if it is possible to do so without ambiguity.
Exact refs starting with refs/ are returned unchanged, like refs/heads/main
or refs/namespaces/foo/refs/heads/main. Git-style ref patterns return the fixed portion before
their single * when it is more specific than refs/: both refs/heads/* and
refs/heads/*/suffix yield refs/heads/.
Negative refspecs and one-sided push refspecs return None.
Sourcepub fn expand_prefixes(&self, out: &mut Vec<BString>)
pub fn expand_prefixes(&self, out: &mut Vec<BString>)
Append the remote-ref prefixes represented by this refspec to out, suitable for limiting the refs
requested from a remote. Unlike prefix(), partial names without an unambiguous prefix
are expanded to all of their Git-style ref-name candidates. For example, main expands to main,
refs/main, refs/tags/main, refs/heads/main, refs/remotes/main, and refs/remotes/main/HEAD.
Fetch refspecs use their source; push refspecs use their explicit destination. Negative refspecs produce no prefixes because they only exclude refs selected by positive refspecs; they do not request remote refs.
Sourcepub fn instruction(&self) -> Instruction<'a>
pub fn instruction(&self) -> Instruction<'a>
Transform the state of the refspec into an instruction making clear what to do with it.
Source§impl RefSpecRef<'_>
Conversion
impl RefSpecRef<'_>
Conversion
Trait Implementations§
Source§impl<'a> Clone for RefSpecRef<'a>
impl<'a> Clone for RefSpecRef<'a>
Source§fn clone(&self) -> RefSpecRef<'a>
fn clone(&self) -> RefSpecRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more