Forward-port: Remove erroneous PathSelector optimization + regression test - #12622
Merged
Merged
Conversation
…zation The optimization skipped path relativization when all include/exclude patterns started with "**". This produced false positives when the base directory path itself contained a segment matching the pattern (e.g., base = "something/target/test-classes" with pattern "**/test-classes/**" would match every file under the base directory). Added a regression test for the exact false-positive scenario. PR: #12621 Original fix by: Martin Desruisseaux (@desruisseaux) Supersedes: #12617 Closes #12621
gnodet
commented
Jul 29, 2026
gnodet
left a comment
Contributor
Author
There was a problem hiding this comment.
Review: APPROVE ✅
Clean forward-port of already-merged PR #12621 from maven-4.0.x to master. The diffs are byte-for-byte identical — no conflicts, no modifications.
The fix correctly removes the flawed needRelativize optimization in PathSelector.simplify() that caused false-positive path matching, and the regression test covers both the true-positive and false-positive scenarios. The only remaining shortcut is the INCLUDES_ALL case for zero includes and zero excludes, which is correct.
This is a gnodet-authored PR, so posting as COMMENT instead of APPROVE.
Reviewed via automated review loop · Feedback? Tag @gnodet
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.
Summary
Forward-port of #12621 from
maven-4.0.xtomaster.needRelativizeoptimization inPathSelectorthat skipped path relativization when all patterns started with**, producing false positives when the base directory path contained a matching segmentCherry-pick applied cleanly with no conflicts.
Original fix by: Martin Desruisseaux (@desruisseaux)
🤖 Generated with Claude Code