Repository navigation
Match a mixed-case glob range the same under both case sensitivities [patch] - #168
Open
matt-edmondson wants to merge 4 commits into
Open
matt-edmondson wants to merge 4 commits into
matt-edmondson wants to merge 4 commits into
Conversation
…[patch] DotNet.Glob lowercases a range's endpoints under CaseInsensitive, so a lone native range whose endpoints differ in case changed meaning: "A-z" became "a-z" and stopped matching "_" and "[", "Z-a" became the empty "z-a", and the reversed "a-Z" became "a-z". Only same-case letter and digit ranges are now left to DotNet.Glob; a mixed-case range is listed explicitly, and a reversed letter range is written as the empty "[9-0]", which matches nothing under either sensitivity, as it already did under CaseSensitive. Fixes #167 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW6QSBbC4yjv9GxYCN1
Replaces the nested ternary in ExpandGlobClasses with a helper, which SonarCloud flagged (S3358, and S3776 cognitive complexity). The case-insensitivity property test now filters its patterns with Where and drops the negated entries it never asserted on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW6QSBbC4yjv9GxYCN1
Resolve the IsNativeGlobRange conflict with #164: a lone range stays native only when its endpoints share a case or are both digits, and it does not span a path separator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5pNp5mLi7vkHCEABR
|
This was referenced Oct 31, 2026
Glob class followed by a literal
] swallows it: *[[][0-9]] matches "items[3" but not "items[3]"
#172
Closed
…ange # Conflicts: # TextFilter/TextFilter.cs
This was referenced Nov 4, 2026
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.



Fixes #167
What changed
IsNativeGlobRangeleaves a lone range to DotNet.Glob only when both endpoints are lower case, both are upper case, or both are ASCII digits, as the issue suggests. A mixed-case range such asA-zorZ-anow goes throughToGlobCharacterList, which already handles case folding correctly.a-ZgivesToGlobCharacterListno members. That returnsnull, so the token was ignored and matched everything, not the expectedfalse. The existingExpandGlobClassesRejectsClassesThatCannotBeListedtest pinsnullfor reversed non-letter ranges like[#-!], so I left that path alone. Instead,IsReversedLetterRangewrites a reversed letter range as[9-0](or[!9-0]). DotNet.Glob reads that as empty, and case folding can't change it. That keeps the result CaseSensitive already gave:[a-Z]matches nothing and[!a-Z]matches any character.Tests
GlobRangeWithMixedCaseEndpointsMatchesTheSameUnderBothSensitivitiescovers every row of the issue's table, including the negated and reversed rows, plus controls. Each row is checked under both sensitivities.GlobRangeWithSameCaseEndpointsStillFoldsUnderCaseInsensitive:[a-z]still matchesMonly under CaseInsensitive.CaseInsensitiveGlobClassMatchesEverythingCaseSensitiveDoesis a property-style check over printable ASCII: every CaseSensitive match of a non-negated class is also a CaseInsensitive match.This edits code near open PRs #162–#166, so a textual conflict with one of them is possible.
Generated by Claude Code