Expand description
Parse .gitattribute files and provide utilities to match against them.
§Examples
use gix_attributes::search::{MetadataCollection, Outcome};
use gix_glob::pattern::Case;
let mut search = gix_attributes::Search::default();
let mut collection = MetadataCollection::default();
search.add_patterns_buffer(
b"*.sh text eol=lf",
"<memory>".into(),
None,
&mut collection,
true,
);
let mut out = Outcome::default();
out.initialize_with_selection(&collection, ["text", "eol"]);
assert!(search.pattern_matching_relative_path("script.sh".into(), Case::Sensitive, Some(false), &mut out));
let assignments = out
.iter_selected()
.map(|m| m.assignment.to_string())
.collect::<Vec<_>>();
assert_eq!(assignments, vec!["text", "eol=lf"]);§Feature Flags
serde— Data structures implementserde::Serializeandserde::Deserialize.
Re-exports§
pub use gix_glob as glob;
Modules§
Structs§
- Assignment
- Name an attribute and describe it’s assigned state.
- Assignment
Ref - Holds validated attribute data as a reference
- Name
- Represents a validated attribute name
- NameRef
- Holds a validated attribute name as a reference
- Search
- A grouping of lists of patterns while possibly keeping associated to their base path in order to find matches.
Enums§
- Source
- A list of known global sources for git attribute files in order of ascending precedence.
- State
- The state an attribute can be in, owning the value.
- State
Ref - The state an attribute can be in, referencing the value.
Functions§
- parse
- Parse attribute assignments line by line from
bytes, and fail the operation on error.