Repository navigation
Match a glob token made only of **/ segments [patch] - #182
Merged
Merged
Conversation
ExpandGlobStarSegments expands a bare "**/" both as "*/" and as the empty string. Glob.Parse throws on the empty pattern, so ResolveGlob marked the whole token unparseable and threw away the valid "*/" expansion: "**/" matched every item and "-**/" hid nothing. Drop empty expansions before parsing, and still treat a token with nothing left as unparseable. Fixes #181 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4QsgMfJRhwEBdboKd
|
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 #181
What was wrong
ExpandGlobStarSegmentsexpands a bare**/both as*/and as the empty string.Glob.Parse("")throws, soResolveGlob's catch marked the whole token unparseable and discarded the valid*/expansion with it. Under the unparseable-token rules,**/then matched every item and-**/("hide directories") hid nothing.Change
ResolveGlobdrops empty expansions before callingGlob.Parse. An empty pattern could only match empty text, which never reaches the matcher. If nothing is left afterwards, the token is still treated as unparseable, as before.Tests
GlobTokenOfOnlyGlobStarSlashMatchesItemsEndingInSeparator(**/,**/**/) returns onlydocs/GlobExcludedTokenOfOnlyGlobStarSlashHidesItemsEndingInSeparator(-**/,-**/**/) hidesdocs/GlobRequiredTokenOfOnlyGlobStarSlashMatchesOnlyItemsEndingInSeparator(+**/)All five cases fail on
main(I reverted the fix to confirm) and pass with it. The full suite passes: 218/218, including the existing**/tests from #114, #126, #135 and #170.The triage comment says to land this after #171. The two change different methods (
ResolveGlobhere,ExpandGlobStarSegmentsthere), so a textual conflict is unlikely.Generated by Claude Code