Skip to content

Drive the search integration off the canonical ignore patterns#2110

Merged
bbatsov merged 3 commits into
masterfrom
refactor/unify-remaining-ignore-fns
Jul 21, 2026
Merged

Drive the search integration off the canonical ignore patterns#2110
bbatsov merged 3 commits into
masterfrom
refactor/unify-remaining-ignore-fns

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Indexing moved onto one gitignore pattern language in #2107, but the grep/ag integration and the two ignore predicates didn't come with it - they kept expanding the dirconfig into absolute path lists of their own. So "ignored" could mean two different things depending on whether you were listing files or searching them.

They now derive from projectile--ignore-patterns, the same source indexing uses. That fixes a few things along the way: under rgrep a pattern is passed as a pattern rather than as whatever it expanded to on disk, ! ensure entries can rescue root-anchored paths, and the globally ignored suffixes are no longer double-injected into grep-find-ignored-files.

projectile-ignored-file-p and projectile-ignored-directory-p change signature - the second optional argument is now the project root, not a pre-computed path list - and eight functions that existed only to build those lists are gone, all callerless after the change. Both noted in the changelog.

One inexactness I couldn't remove and documented instead: * in a find -path glob crosses /, so a root-anchored pattern like -/*.txt over-prunes under plain rgrep. Every other tool takes gitignore globs directly.

New specs assert the equivalence directly: grep's exclusion list and indexing's agree for the same config, and the predicates agree with projectile-remove-ignored.

bbatsov added 3 commits July 21, 2026 11:47
The rgrep and ag integrations still expanded the dirconfig into absolute
paths of their own, so a search could see a different set of files than
indexing did - a pattern that matched nothing on disk when the search
started simply wasn't excluded.  Both now partition
`projectile--ignore-patterns' into the anchored and floating specs the
tools want, and the `!' ensure entries are subtracted from the whole
find expression rather than from the floating half only.
`projectile-ignored-file-p' and `projectile-ignored-directory-p' were the
last consumers of the pre-unification absolute-path machinery, so they
could disagree with indexing about what "ignored" means.  They now match
the root-relative name against the same compiled patterns, ensure
entries included, which also lets `projectile-cache-current-file' drop
its separate parent-directory check.

That leaves the path-list helpers behind them (`projectile-ignored-files',
`projectile-ignored-directories', the -rel variants and the
`projectile-project-ignored*' / `projectile-paths-to-ignore' family)
without callers, so they're gone.
@bbatsov
bbatsov merged commit e8e1b81 into master Jul 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant