Expand description
Parse git ref-specs and represent them.
§Examples
use bstr::ByteSlice;
use gix_refspec::parse::Operation;
let spec = gix_refspec::parse(
"refs/heads/*:refs/remotes/origin/*".into(),
Operation::Fetch,
)
.unwrap();
assert_eq!(spec.remote().unwrap(), "refs/heads/*");
assert_eq!(spec.local().unwrap(), "refs/remotes/origin/*");
assert_eq!(spec.prefix().unwrap(), "refs/heads/");
let mut prefixes = Vec::new();
spec.expand_prefixes(&mut prefixes);
assert_eq!(prefixes.len(), 1);
assert_eq!(prefixes[0].as_bstr(), "refs/heads/");
assert_eq!(spec.to_bstring(), "refs/heads/*:refs/remotes/origin/*");Modules§
Structs§
- Match
Group - A match group is able to match a list of ref specs in order while handling negation, conflicts and one to many mappings.
- RefSpec
- An owned refspec.
- RefSpec
Ref - A refspec with references to the memory it was parsed from.
Enums§
- Instruction
- Tells what to do and is derived from a
RefSpec.
Functions§
- parse
- Parse
specfor use inoperationand return it if it is valid.