Skip to main content

Module ignores

Module ignores 

Source
Expand description

Configurable exclusion for a synced root (docs/design/fs-watch.md “Ignoring”).

Three sources, composed into one matcher and evaluated per path:

  • .git — a pure name filter, no git data read.
  • ignore files — the enclosing worktree’s exclude stack: every .gitignore / .ignore from the worktree top down to the deepest directory on the path, plus $GIT_DIR/info/exclude and the user’s core.excludesFile.
  • client patterns — gitignore syntax, anchored at the sync root, highest precedence so !keep-this re-includes what the rest hide.

Precedence is git’s: the deepest ignore file wins over shallower ones, a match on an ancestor directory excludes everything below it (which is why a negation cannot resurrect a file under an excluded directory), and client patterns sit above the whole stack.

Filtering is not a view over a full index — an excluded path is never stated, indexed, hashed, or counted against the entry budget, and its hints are dropped before the settle tick. That is the whole point: a sync of a checkout should cost the checkout, not node_modules.

Structs§

IgnoreSpec
What a sync excludes. Part of the shared root’s identity (crate::RootKey): two syncs indexing different trees cannot share a reconciler, exactly as for recursive — so this derives Hash/Eq over the normalized pattern list rather than over a compiled matcher.
Ignores
Compiled exclusion for one root. Per-directory matchers are built on first use and memoized, so the initial scan reads each .gitignore once and incremental reconciliation reads none.

Constants§

DOT_IGNORE_NAME
The non-git per-directory ignore file — ripgrep’s convention, honored by the FS_INDEX / FS_GREP walkers and selectable here on its own.
GITIGNORE_NAME
The git per-directory ignore file. Lower in the same directory than DOT_IGNORE_NAME is: within one directory .gitignore wins, matching the walkers.
MAX_PATTERNS
Cap on client patterns, so a hostile FS_SYNC cannot compile an unbounded glob set. Refused at request validation, not silently cut.