Expand description
.gitattributes parsing and matching.
Backed by gix-attributes + gix-glob, which together implement Git’s
wildmatch + macro + per-directory precedence semantics. The “shell out
to git, not gix” rule in CLAUDE.md applies to runtime git operations
(rev-list, cat-file, etc.), not to using gix-* crates as parsing libs.
Two construction modes:
AttrSet::from_workdir— discover and load every.gitattributesin the working tree, plus.git/info/attributes. Per-directory files take precedence overinfo/attributes; deeper directories win over shallower (Git’s standard “more specific wins”).AttrSet::from_buffer— load from a single in-memory buffer. For tests and one-shot matching that doesn’t need a workdir.
Once built, query with AttrSet::value / AttrSet::is_set, plus
the LFS-specific helpers AttrSet::is_lfs_tracked /
AttrSet::is_lockable.
Structs§
- AttrSet
- A queryable set of
.gitattributespatterns. - Pattern
Entry - A single LFS-related pattern line discovered while listing.
- Pattern
Listing - All LFS-related patterns visible in a workdir, in load order
(
.git/info/attributesfirst, then.gitattributesfrom shallow to deep).
Functions§
- list_
lfs_ patterns - Walk
.gitattributesacross the workdir plus.git/info/attributes, extracting LFS-related pattern lines forgit lfs track’s listing mode.