Skip to main content

Module worktree_ignore

Module worktree_ignore 

Source
Expand description

Ignore pattern helpers for worktree operations.

.heddleignore follows the same syntax as .gitignore: literal names, leading / for root-anchored rules, trailing / for directory-only matches, * and ** glob wildcards, character classes ([abc]), and ! negation (whitelist) rules. The matcher delegates to the ignore crate’s gitignore implementation so the semantics are spec-compliant; only the patterns themselves are sourced from .heddleignore instead of .gitignore.

Three “root-admin” pattern names — .heddle, .heddleignore, and .git — get an implicit leading / so they match only at the repo root. This preserves the long-standing invariant that a nested .heddle/ directory (e.g. an examples/calculator/.heddle fixture) is captured, not silently dropped. Operators who want the gitignore-spec “match anywhere” behavior for those names can write **/<name> explicitly.

Structs§

WorktreeIgnoreMatcher
A compiled .heddleignore matcher. Compiling the glob set is the expensive part; matching a single path against an already-built matcher is cheap. Callers that test many paths against the same patterns (e.g. counting unignored entries across a large diff) should build the matcher once and reuse it, rather than paying the per-path compile cost that the should_ignore convenience wrapper incurs.

Functions§

build_worktree_ignore
Compile a WorktreeIgnoreMatcher from the given pattern strings, once, for reuse across many path checks. This is the compile-once counterpart to should_ignore, which rebuilds the matcher on every call.
should_ignore
Whether path is covered by any of the .heddleignore patterns.