pub struct PathspecMatcher<'s> { /* private fields */ }Expand description
A resolved pathspec list bound to one repository’s matching rules, built by
crate::repo::Repository::pathspec_matcher.
Holds the repository’s attributes when a spec carries :(attr:...) magic, so testing many
paths reads them once. Attr requirements see [attr] macro expansion and match attribute
patterns case-insensitively when core.ignorecase is set, as Git does. Paths are treated as regular files: a spec ending in / does not match
a path equal to its directory, and builtin_objectmode reads as 100644. Use
matches_pathspec_list_for_object when the entry mode matters.
Implementations§
Source§impl<'s> PathspecMatcher<'s>
impl<'s> PathspecMatcher<'s>
Sourcepub fn matches(&self, path: &str) -> bool
pub fn matches(&self, path: &str) -> bool
Whether path is selected: it matches at least one positive spec (any path when there
are none or the list is empty) and no :(exclude) spec.
Sourcepub fn matches_entry(&self, path: &str, mode: u32) -> bool
pub fn matches_entry(&self, path: &str, mode: u32) -> bool
Like Self::matches, but uses Git tree/index entry mode for trailing-slash and
submodule pathspec semantics.
Required for path-limited history walks and staging when specs include :(attr:...) magic.