Struct git_attributes::MatchGroup
source · pub struct MatchGroup<T: Pattern = Attributes> {
pub patterns: Vec<PatternList<T>>,
}
Expand description
A grouping of lists of patterns while possibly keeping associated to their base path.
Pattern lists with base path are queryable relative to that base, otherwise they are relative to the repository root.
Fields§
§patterns: Vec<PatternList<T>>
A list of pattern lists, each representing a patterns from a file or specified by hand, in the order they were specified in.
During matching, this order is reversed.
Implementations§
source§impl<T> MatchGroup<T>where
T: Pattern,
impl<T> MatchGroup<T>where T: Pattern,
source§impl MatchGroup<Ignore>
impl MatchGroup<Ignore>
sourcepub fn from_git_dir(
git_dir: impl AsRef<Path>,
excludes_file: Option<PathBuf>,
buf: &mut Vec<u8>
) -> Result<Self>
pub fn from_git_dir( git_dir: impl AsRef<Path>, excludes_file: Option<PathBuf>, buf: &mut Vec<u8> ) -> Result<Self>
Given git_dir
, a .git
repository, load ignore patterns from info/exclude
and from excludes_file
if it
is provided.
Note that it’s not considered an error if the provided excludes_file
does not exist.
sourcepub fn from_overrides(
patterns: impl IntoIterator<Item = impl Into<OsString>>
) -> Self
pub fn from_overrides( patterns: impl IntoIterator<Item = impl Into<OsString>> ) -> Self
See PatternList::
sourcepub fn add_patterns_file(
&mut self,
source: impl Into<PathBuf>,
follow_symlinks: bool,
root: Option<&Path>,
buf: &mut Vec<u8>
) -> Result<bool>
pub fn add_patterns_file( &mut self, source: impl Into<PathBuf>, follow_symlinks: bool, root: Option<&Path>, buf: &mut Vec<u8> ) -> Result<bool>
Add the given file at source
if it exists, otherwise do nothing. If a root
is provided, it’s not considered a global file anymore.
Returns true if the file was added, or false if it didn’t exist.
sourcepub fn add_patterns_buffer(
&mut self,
bytes: &[u8],
source: impl Into<PathBuf>,
root: Option<&Path>
)
pub fn add_patterns_buffer( &mut self, bytes: &[u8], source: impl Into<PathBuf>, root: Option<&Path> )
Add patterns as parsed from bytes
, providing their source
path and possibly their root
path, the path they
are relative to. This also means that source
is contained within root
if root
is provided.
Trait Implementations§
source§impl<T: Clone + Pattern> Clone for MatchGroup<T>
impl<T: Clone + Pattern> Clone for MatchGroup<T>
source§fn clone(&self) -> MatchGroup<T>
fn clone(&self) -> MatchGroup<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T: Default + Pattern> Default for MatchGroup<T>
impl<T: Default + Pattern> Default for MatchGroup<T>
source§fn default() -> MatchGroup<T>
fn default() -> MatchGroup<T>
source§impl<T: Ord + Pattern> Ord for MatchGroup<T>
impl<T: Ord + Pattern> Ord for MatchGroup<T>
source§fn cmp(&self, other: &MatchGroup<T>) -> Ordering
fn cmp(&self, other: &MatchGroup<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<T: PartialEq + Pattern> PartialEq<MatchGroup<T>> for MatchGroup<T>
impl<T: PartialEq + Pattern> PartialEq<MatchGroup<T>> for MatchGroup<T>
source§fn eq(&self, other: &MatchGroup<T>) -> bool
fn eq(&self, other: &MatchGroup<T>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<T: PartialOrd + Pattern> PartialOrd<MatchGroup<T>> for MatchGroup<T>
impl<T: PartialOrd + Pattern> PartialOrd<MatchGroup<T>> for MatchGroup<T>
source§fn partial_cmp(&self, other: &MatchGroup<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &MatchGroup<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more