-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Globstar returns its parent directory as a match when it should not #21
Comments
Looks like micromatch/micromatch#167. |
I agree. And it appears that micromatch/micromatch#167 is caused by micromatch's dependency on picomatch. If you think it will help the debugging effort, I can try and issue a pr. |
Let me know what you think. I can solve this in picomatch in a couple of different ways: Solution 1 On this line of code: Line 794 in 8ebe96d
We can just make patterns that end in prev.output = globstar(opts) + ')'; Solution 2 Or, on that same line of code, we can make this optional by doing the following: prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); FWIW, I think I implemented it this way based on previous discussions on micromatch, where the consensus was that In the meantime, you can do the following to work around this: const isMatch = picomatch('foo/**', { ignore: ['foo'] }); Not the most elegant solution, but there are tradeoffs either way. If we make |
I prefer current behavior. However, we previously chose Bash as the source. Of these two options, I prefer the second, because this behavior is useful for my packages (previously, we check the original entry and entry with trailing slash for directories). |
My vote (if I would have any ;)) would be for the 'old' (micromatch v3) behavior, because it's less surprising. I can imagine just changing it to Solution 1 will upset current v4 users though, so probably Solution 2 would be better. If it is actually more of a 'bug' (accidental change since v3, rather), maybe the default value for |
I'm inclined to agree with you. This seems like a regression since I mistakenly thought that we had decided that Given that, and based on this comment from @mrmlnc:
I'm going to go with option 2, with |
Good. I will change the |
Good day all. With the latest release, setting Just a thought: in a future release, it would be a good idea to have |
When trying to match the contents of a parent directory, using a globstar returns the parent as a match. This does not abide by the behavior of globstars in BASH.
Environment
shell BASH
node v12.1.0
picomatch v2.0.7
Sample code
bash:
node:
Expected result
bash:
node:
Actual result
bash:
node:
The text was updated successfully, but these errors were encountered: