-
Notifications
You must be signed in to change notification settings - Fork 2.8k
FileSelector.matches(Path) sometime wrong for a file or a directory
#11551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
desruisseaux
merged 4 commits into
apache:master
from
Geomatys:chore/optimize-directory-matcher
Dec 15, 2025
Merged
FileSelector.matches(Path) sometime wrong for a file or a directory
#11551
desruisseaux
merged 4 commits into
apache:master
from
Geomatys:chore/optimize-directory-matcher
Dec 15, 2025
Conversation
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
PathMatcher for directoriesPathMatcher for directories
elharo
requested changes
Dec 14, 2025
impl/maven-impl/src/main/java/org/apache/maven/impl/PathSelector.java
Outdated
Show resolved
Hide resolved
…ect `PathMatcher` for directories. This commit moves the `dirIncludes` and `dirExcludes` matchers in an inner class that implements `PathMatcher` directly (the indirection level through a lambda function is removed). The relocated code is mostly identical to previous code, except for the new `DirectoryPrefiltering.simplify()` method doing the same work as `PathSelector.simplify()`.
49cf69f to
30a48ff
Compare
* Brace expansion must be applied also to the "/**" path suffix. * Detection of "match all" pattern must take brace expansion in account. * Optimization for excluding whole directories should be more conservative.
Contributor
Author
|
This pull request is no longer an optimization but a real bug fix now. I will edit the description soon. |
PathMatcher for directoriesFileSelector.matches(Path) sometime wrong for a file or a directory
elharo
reviewed
Dec 14, 2025
impl/maven-impl/src/main/java/org/apache/maven/impl/PathSelector.java
Outdated
Show resolved
Hide resolved
gnodet
approved these changes
Dec 15, 2025
desruisseaux
added a commit
to Geomatys/maven
that referenced
this pull request
Dec 15, 2025
…pache#11551) * Brace expansion must be applied also to the "/**" path suffix. * Detection of "match all" pattern must take brace expansion in account. * Optimization for excluding whole directories should be more conservative. * Create the directory matchers only if requested and return a more direct `PathMatcher` for directories.
desruisseaux
added a commit
that referenced
this pull request
Dec 16, 2025
…11551) * Brace expansion must be applied also to the "/**" path suffix. * Detection of "match all" pattern must take brace expansion in account. * Optimization for excluding whole directories should be more conservative. * Create the directory matchers only if requested and return a more direct `PathMatcher` for directories.
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.
This pull request fixes the following bugs in
PathSelector:Those problems were identified by the following steps applied locally:
maven-4.0.xbranch.PathSelector.With this pull request, all above-cited integration tests pass.
Note on refactoring
This commit moves the
dirIncludesanddirExcludesmatchers to an inner class that implementsPathMatcherdirectly (the indirection level through a lambda function is removed). With this change, the directory matchers are created only if requested and can be provided by a more directPathMatcher. The new code is a bit more conservative about directory filtering.