pub struct AttrSet { /* private fields */ }Expand description
A queryable set of .gitattributes patterns.
Implementations§
Source§impl AttrSet
impl AttrSet
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty set, seeded only with Git’s built-in [attr]binary macro
(so patterns referencing binary resolve correctly).
Sourcepub fn from_buffer(bytes: &[u8]) -> Self
pub fn from_buffer(bytes: &[u8]) -> Self
Build from a single .gitattributes-format buffer.
Sourcepub fn add_buffer_at(&mut self, bytes: &[u8], dir: &str)
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).
Sourcepub fn from_workdir(repo_root: &Path) -> Result<Self>
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.
Sourcepub fn value(&self, path: &str, attr: &str) -> Option<String>
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).
Sourcepub fn is_set(&self, path: &str, attr: &str) -> bool
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".
Sourcepub fn is_lfs_tracked(&self, path: &str) -> bool
pub fn is_lfs_tracked(&self, path: &str) -> bool
True iff path matches a filter=lfs line.
Sourcepub fn is_lockable(&self, path: &str) -> bool
pub fn is_lockable(&self, path: &str) -> bool
True iff path matches a lockable line.