fix: make FileFilter patterns case-insensitive - #859
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
|
@Itachi7011 Nice first contribution — the fix is exactly right, and I appreciate that you kept it minimal instead of refactoring around it. I pulled the branch locally: tests pass, and I confirmed the new assertions genuinely fail once Three small suggestions, none of them blocking: 1. Use mixed-case paths in the test. The new assertions pair an uppercase pattern with an all-lowercase path: if !f.IsUserIncluded("docs/changelog.md") { ... }
if !f.IsUserExcluded("readme.md") { ... }That does catch the regression, but it sidesteps the spelling people actually hit — pattern and path both containing uppercase, e.g. if !f.IsUserIncluded("docs/CHANGELOG.md") { ... }
if !f.IsUserExcluded("README.md") { ... }2. Add one brace-expansion case. The only interaction still untested is the ordering of Exclude: []string{"**/*.{Go,Java}"}, // assert "pkg/Main.JAVA" is excluded3. State the contract in the doc comments. Neither // IsUserExcluded reports whether the given path matches any user exclude pattern.
// The check is case-insensitive: both path and pattern are lowercased.Thanks again — clean, well-scoped patch. |
|
Thanks for the detailed review! I appreciate the suggestions. I'll keep these in mind. Glad to hear the fix and regression coverage look good. 🙏 |
lizhengfeng101
left a comment
There was a problem hiding this comment.
@Itachi7011 I'd like to see your updates regarding these three small suggestions.
|
Thanks for the review! I've addressed all three suggestions:
I also ran |
|
Congrats on landing your first contribution, @Itachi7011 — clean fix, regression test included, merged within a day. Exactly how it should go. Welcome aboard 🎉 |
Summary
Fixes #844.
FileFilter.IsUserIncludedandFileFilter.IsUserExcludedlowercasedthe file path before matching, but did not lowercase the user-provided
pattern.
This caused patterns containing uppercase letters such as
README.mdand**/CHANGELOG.mdto fail to match.Changes
doublestar.Matchdoublestar.MatchTestFileFilter_CaseInsensitivewith uppercase-patternregression coverage
Testing