Skip to main content

PathspecMatcher

Struct PathspecMatcher 

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

Source

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.

Source

pub fn matches_change(&self, path: &str, old_path: Option<&str>) -> bool

Whether a changed file is selected, checking its current path and, for a rename or copy, its old_path too (Git limits diffs on either side of a rename).

Source

pub fn is_empty(&self) -> bool

Whether the list is empty (every path is selected).

Trait Implementations§

Source§

impl<'s> Clone for PathspecMatcher<'s>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'s> Debug for PathspecMatcher<'s>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s> Freeze for PathspecMatcher<'s>

§

impl<'s> RefUnwindSafe for PathspecMatcher<'s>

§

impl<'s> Send for PathspecMatcher<'s>

§

impl<'s> Sync for PathspecMatcher<'s>

§

impl<'s> Unpin for PathspecMatcher<'s>

§

impl<'s> UnsafeUnpin for PathspecMatcher<'s>

§

impl<'s> UnwindSafe for PathspecMatcher<'s>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.