-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fast-glob doesn't match list segments correctly #365
Comments
@mrmlnc When checking this out in a bit more detail, it seems like when matching list segments the To be clear, this means you get equal results currently for:
but failing results for:
|
Followed up on this a bit more, the issue might be in micromatch or picomatch rather then the fast-glob package. It looks like for the above glob pattern,
It should return something closer to this:
There is a pair of characters between literal - ^(?:(book\.xml|(?:(?:(?!(?:^|\/)\.).)*?)\/library\/(?!\.)(?=.)[^/]*?\/book\.md))$
+ ^(?:(book\.xml|(?:(?:(?!(?:^|\/)\.).)*?)library\/(?!\.)(?=.)[^/]*?\/book\.md))$ |
'**/library/*/book.md'
micromatch
{
re: /^(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)library\/(?!\.)(?=.)[^/]*?\/book\.md)$/
}
fast-glob.utils.pattern.makeRe
{
re: /^(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)library\/(?!\.)(?=.)[^/]*?\/book\.md)$/
}
---
'{book.xml,**/library/*/book.md}'
micromatch
{
re: /^(?:(book\.xml|(?:(?:(?!(?:^|\/)\.).)*?)\/library\/(?!\.)(?=.)[^/]*?\/book\.md))$/
}
fast-glob.utils.pattern.makeRe
{
re: /^(?:(book\.xml|(?:(?:(?!(?:^|\/)\.).)*?)\/library\/(?!\.)(?=.)[^/]*?\/book\.md))$/
} Well, looks like this is really a problem in the // {book.xml,**/library/*/book.md}
/^(?:(book\.xml|(?:(?:(?!(?:^|\/)\.).)*?)\/library\/(?!\.)(?=.)[^/]*?\/book\.md))$/
// **/library/*/book.md
/^(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)library\/(?!\.)(?=.)[^/]*?\/book\.md)$/ A little later I will create an issue in micromatch and try to find the reason for the current behavior. |
@mrmlnc Is there an upstream issue link for this? I'm trying to keep an eye on this. If there is any way that I can help out, let me know. This issue currently presents in Nx when we combine glob patterns for finding plugin project files. |
Hey @mrmlnc! Just checking in on this again. If someone can point me to the right spot to start making changes I'd be happy to investigate this a bit further myself. |
I repro'd on the picomatch repo and opened an issue there, hoping to accelerate this one too. Let me know if there is anything else from my side that could help with this. |
Awesome! Thanks for the fix @mrmlnc! Happy maintainers month, hoping things are well for you. |
Environment
Actual behavior
List-segments are matched in a way that is compatible with
glob
Expected behavior
Some matches are not reported properly when using glob patterns containing quotes
Steps to reproduce
The text was updated successfully, but these errors were encountered: