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/.ignorefrom the worktree top down to the deepest directory on the path, plus$GIT_DIR/info/excludeand the user’score.excludesFile. - client patterns — gitignore syntax, anchored at the sync root,
highest precedence so
!keep-thisre-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§
- Ignore
Spec - What a sync excludes. Part of the shared root’s identity (
crate::RootKey): two syncs indexing different trees cannot share a reconciler, exactly as forrecursive— so this derivesHash/Eqover 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
.gitignoreonce 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_GREPwalkers and selectable here on its own. - GITIGNORE_
NAME - The git per-directory ignore file. Lower in the same directory than
DOT_IGNORE_NAMEis: within one directory.gitignorewins, matching the walkers. - MAX_
PATTERNS - Cap on client patterns, so a hostile
FS_SYNCcannot compile an unbounded glob set. Refused at request validation, not silently cut.