Repository navigation
feat: .codesearchinclude whitelist — index only matching files when present - #346
Merged
Merged
Conversation
…resent Next to the ignore machinery there was no way to say 'index ONLY these'. A .codesearchinclude at the repo root (plus a global ~/.codesearch/.codesearchinclude, lowest precedence) now acts as a whitelist: when it exists, a file is indexed only when the file itself or an ancestor matches an include rule (src/ covers src/a/b.rs), and a !-rule inside the file un-includes again (last match along the component chain wins, mirroring gitignore order). Ignore rules still win first — an include can never resurrect an ignored file. Absent or empty list = historical behavior (index everything the ignore rules allow). Both gates share the semantics: the walker (before the binary probe, counted in the previously-reserved skipped_ignored stat) and the watcher's is_watchable (incremental reindex follows the same whitelist). Pinned by 4 tests: walker whitelist+ancestor, negation, absent-list no-op, watcher gate.
…hinclude # Conflicts: # AGENTS.md
Stage 2: CHANGELOG entry under the pending version (### Added), one highlights line, plan ticked. Full validation green (fmt, clippy --all-targets -D warnings, cargo test --lib --bins). Review deviation: the reviewer subagent aborted twice (quota) — stage 1 was self-reviewed read-only instead; all invariants checked against the diff (absent-list no-op, Match<&Glob> handling, ancestor walk, gate placement, ignore-wins-first, negation, global-to-local order).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Next to the ignore machinery there was no way to say "index ONLY these". A
.codesearchincludeat the repo root (plus a global~/.codesearch/.codesearchinclude, lowest precedence) now acts as a whitelist: when it exists, a file is indexed only when the file itself or an ancestor matches its gitignore-style rules (src/coverssrc/a/b.rs), and a!-rule un-includes again (last match along the component chain wins, mirroring gitignore order).Semantics: ignore rules still win first — an include can never resurrect an ignored file — and an absent or empty list keeps the historical behavior. Both gates share the implementation shape: the walker (gate after the ignore machinery, before the binary probe, counted in the previously-reserved
skipped_ignoredstat) and the watcher'sis_watchable, so incremental reindex follows the same whitelist.Pinned by 4 tests: walker whitelist+ancestor, negation, absent-list no-op, watcher gate. Validation: fmt clean, clippy
--all-targets -D warningsclean,cargo test --lib --binsgreen (includes the PR #308 merge).