Skip to main content

Module attr

Module attr 

Source
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 .gitattributes in the working tree, plus .git/info/attributes. Per-directory files take precedence over info/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 .gitattributes patterns.
PatternEntry
A single LFS-related pattern line discovered while listing.
PatternListing
All LFS-related patterns visible in a workdir, in load order (.git/info/attributes first, then .gitattributes from shallow to deep).

Functions§

list_lfs_patterns
Walk .gitattributes across the workdir plus .git/info/attributes and the user’s core.attributesfile (if configured), extracting LFS-related pattern lines for git lfs track’s listing mode.