Skip to main content

Crate gix_refspec

Crate gix_refspec 

Source
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§

instruction
match_group
parse

Structs§

MatchGroup
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.
RefSpecRef
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 spec for use in operation and return it if it is valid.