Fixup #14021 (Add file mode specifier to PathMatch)#7689
Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom Jul 31, 2025
Merged
Fixup #14021 (Add file mode specifier to PathMatch)#7689danmar merged 1 commit intocppcheck-opensource:mainfrom
danmar merged 1 commit intocppcheck-opensource:mainfrom
Conversation
|
danmar
reviewed
Jul 24, 2025
Collaborator
danmar
left a comment
There was a problem hiding this comment.
would it make sense to tweak the manual a bit?
Collaborator
|
I merge this with the assumption that the manual will be updated soonish.. |
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.



This is an addendum to #7645 that adds the ability to specify directory-only matching in PathMatch patterns with a trailing slash. I originally didn't add this because I wanted to keep PathMatch purely syntactic, and this feature seemed like it would require filesystem calls in the PathMatch code.
This PR solves that problem by lifting the responsibility of file mode checking to the caller, thus keeping PathMatch purely syntactic while still supporting directory-only matching.
Previously
/test/foo/would match/test/fooeven iffoois a regular file. With this change the caller can specify the file mode of the file named by the provided path, and/test/foowill only match when the file mode is directory.The semantics of patterns that do not have a trailing slash is unchanged, e.g.
/test/foostill matches/test/foo/and/test/foo/bar.cpp, regardless of the file mode.Also adds some more tests.