8000 feat: apply .projectile ignore/ensure patterns to file listing by takeokunn · Pull Request #1970 · bbatsov/projectile · GitHub
[go: up one dir, main page]

Skip to content

feat: apply .projectile ignore/ensure patterns to file listing#1970

Open
takeokunn wants to merge 1 commit intobbatsov:masterfrom
takeokunn:feature/issue-1771
Open

feat: apply .projectile ignore/ensure patterns to file listing#1970
takeokunn wants to merge 1 commit intobbatsov:masterfrom
takeokunn:feature/issue-1771

Conversation

@takeokunn
Copy link
Contributor

Summary

Fix #1771 - Apply .projectile ignore/ensure patterns to file listing using regex matching for recursive glob support.

Changes

  • Replace file-expand-wildcards with wildcard-to-regexp for pattern matching
  • projectile--pattern-to-regex: Convert glob pattern to regex
  • projectile--file-matches-patterns-p: Match patterns against file paths
    • Patterns without / (e.g., *.text) match against basename (recursive)
    • Patterns with / (e.g., src/*.c) match against full relative path
  • Update projectile-remove-ignored to use new pattern matching
  • Filter path traversal patterns (..) in projectile-normalise-patterns

Rationale

The original implementation used file-expand-wildcards which only searches the current directory and requires files to exist on the filesystem.
By using wildcard-to-regexp, patterns are converted to regular expressions that can match against any file path string, enabling recursive matching across all subdirectories.

Test Coverage

  • Test for basic glob pattern filtering (*.text, *.log)
  • Test for ensure pattern priority (unignore with !)
  • Test for false positive prevention (basename matching)
  • Test for path traversal pattern filtering (..)

- Apply .projectile ignore and ensure patterns to file listing, not just grep
- Respect patterns prefixed with - in projectile-remove-ignored
- Filter out path traversal patterns (containing ..) in projectile-normalise-patterns for security
- Update and expand tests for ignore/ensure pattern handling
- Update documentation and changelog for new ignore behavior
@takeokunn takeokunn marked this pull request as ready for review January 31, 2026 11:13
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.

Globbing ignored in .projectile (projectile-current-project-files)

1 participant

0