Skip to content

Keep a **/ inside a glob class as literal members [patch] - #202

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/201-globstar-inside-class
Nov 11, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/201-globstar-inside-class

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #201

What changed

ExpandGlobStarSegments adds a zero-segment expansion for each **/ that follows a separator. It did this for a **/ inside a bracket class too, where **/ is only the members * and /. In a negated class, that removed characters from the excluded set, so x[!/**/] matched "x*", and -x[!/**/] hid items it should have kept.

It now finds the closed class spans first, using FindGlobClassEnd, the same boundary rules ExpandGlobClasses uses (a leading ] is a member; ! and ^ negate). Any **/ inside a class is skipped, so it stays literal.

Tests

  • New: x[!/**/], x[!a/**/], x[^/**/] don't match "x*". x[!a/**/] still rejects "xa" and accepts "xb". A positive class with **/ inside still works. [a]/**/b still expands its real globstar. -x[!/**/] keeps "x*".
  • Checked that the four negated-class assertions fail with the fix reverted and pass with it.
  • Full suite: 277 of 278 pass. The one failure, ReadmeTests.EveryMethodInTheReadmeApiReferenceExistsWithItsDocumentedDefaults (documented defaults for IsMatch/Filter), also fails on unmodified main and is unrelated.

Generated by Claude Code

ExpandGlobStarSegments dropped every "**/" that followed a separator,
including one inside a bracket class, where it is just the members "*"
and "/". For a negated class that removed characters from the excluded
set, so x[!/**/] matched "x*". A "**/" inside a closed class is now
skipped, using the same class boundaries as ExpandGlobClasses.

Fixes #201

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW3RphV1aRzPmhMhf5m
…patch]

The README API test required every overload's same-named parameter to carry
the documented default. The binary-compatibility overloads from #166 have no
defaults by design, so main has been red since #178. They are marked
[EditorBrowsable(Never)] and are not what the README documents, so the default
check now skips them. A wrong default on a visible overload still fails.

Fixes #183

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW6FzBtSrY5LKUuDYce
(cherry picked from commit 9328e00)

Copy link
Copy Markdown
Contributor Author

ci / .NET / Test on ubuntu-latest failed on ReadmeTests.EveryMethodInTheReadmeApiReferenceExistsWithItsDocumentedDefaults. That test also fails on main (#183), and this PR doesn't touch the README or the overloads it checks. I cherry-picked the existing fix from #186 (9328e00) onto this branch so CI can go green without waiting for #186. The full suite now passes locally, 278/278. When #186 merges first, the picked commit is a no-op.


Generated by Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 2600158 into main Nov 11, 2026
15 checks passed
@matt-edmondson
matt-edmondson deleted the fix/201-globstar-inside-class branch November 11, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A negated glob class that contains /**/ stops excluding *: x[!/**/] matches "x*"

2 participants