Skip to main content

AttrSet

Struct AttrSet 

Source
pub struct AttrSet { /* private fields */ }
Expand description

A queryable set of .gitattributes patterns.

Implementations§

Source§

impl AttrSet

Source

pub fn empty() -> Self

Empty set, seeded only with Git’s built-in [attr]binary macro (so patterns referencing binary resolve correctly).

Source

pub fn from_buffer(bytes: &[u8]) -> Self

Build from a single .gitattributes-format buffer.

Source

pub fn add_buffer_at(&mut self, bytes: &[u8], dir: &str)

Add a .gitattributes buffer that should match paths under dir (forward-slash separated, no trailing slash, "" for the repo root). For per-commit evaluation during streaming rewrites where the on-disk working tree isn’t authoritative. Order of calls matters — gix-attributes iterates lists in reverse, so deeper directories should be added after shallower ones to win precedence (matching Git’s “more specific path overrides shallower” semantics).

Source

pub fn from_workdir(repo_root: &Path) -> Result<Self>

Discover every .gitattributes reachable from repo_root (skipping the .git/ directory) and load them along with .git/info/attributes if it exists.

Source

pub fn value(&self, path: &str, attr: &str) -> Option<String>

Return the resolved value of attr for path (relative to the repo root, with / separators). None for unspecified or unset. Set/Value(v) map to Some("true") / Some(v).

Source

pub fn is_set(&self, path: &str, attr: &str) -> bool

True iff attr is set for path — that is, attr or attr=<v> where v is anything other than the literal "false".

Source

pub fn is_lfs_tracked(&self, path: &str) -> bool

True iff path matches a filter=lfs line.

Source

pub fn is_lockable(&self, path: &str) -> bool

True iff path matches a lockable line.

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.