Repository navigation
Conversation
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 #147
A
/**right before a|inside a group was compiled as a single*, so the order of alternatives changed the result:The same happened with extglobs.
@(a/**|b)did not matcha/b/c, and!(a/**|b)did match it.Cause
The pipe handler pushes
|as atexttoken. Whenpush()sees a non-boundary token right after a globstar, it demotes the globstar to a single star. Slashes, parens, braces and extglob tokens are exempt, but a pipe inside a group was not. Theextglobs.length && tok.type === 'pipe'check was meant to cover this, but no token is ever created with typepipe, so it never ran. The last alternative worked only because)is exempt.Fix
push(), treat a|inside parens as a boundary so the preceding globstar stays a globstar.|inside parens as the end of that alternative, the same way**does not work when in parentheses #142 handles a globstar followed only by closing parens. So(feature/**|other)matchesfeature, same as(other|feature/**)andfeature/**. Negated extglobs are still excluded from this, as in**does not work when in parentheses #142.The
|token keeps typetext, soparse()output is unchanged (thefoo.(m|c|)jstoken test still passes).Testing
Added a case to
test/issue-related.jscovering both orders for plain groups,@(),!(), matching the parent path, and dotfiles still being excluded.npx mocha test/issue-related.jswithout thelib/parse.jschange: 9 passing, 1 failingnpx mocha: 1999 passingnpm run lint: clean