Drive the search integration off the canonical ignore patterns#2110
Merged
Conversation
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.
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.
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: underrgrepa 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 intogrep-find-ignored-files.projectile-ignored-file-pandprojectile-ignored-directory-pchange 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 afind -pathglob crosses/, so a root-anchored pattern like-/*.txtover-prunes under plainrgrep. 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.