Skip to content
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

An entry that should be included is ignored #138

Closed
zkochan opened this issue Nov 10, 2018 · 5 comments
Closed

An entry that should be included is ignored #138

zkochan opened this issue Nov 10, 2018 · 5 comments

Comments

@zkochan
Copy link
Contributor

zkochan commented Nov 10, 2018

Environment

  • OS Version: Linux
  • Node.js Version: 10.12.0

Actual behavior

An entry is ignored even though it should not be matched by any ignore patterns

Expected behavior

'packages/foo-foo/package.json' is not ignored by the ignore pattern: !**/foo/**/package.json

Code sample

You can clone this repo and run npm install && node index.js

'use strict'
const glob = require('fast-glob')

glob([
  '**/packages/**/package.json',
  '!**/foo/**/package.json',
])
.then((entries) => console.log(entries))
@mrmlnc mrmlnc self-assigned this Nov 10, 2018
@mrmlnc
Copy link
Owner

mrmlnc commented Nov 10, 2018

Thanks for issue. I will look into it soon.

@zkochan
Copy link
Contributor Author

zkochan commented Nov 10, 2018

One thing I just noticed. If I change the ignore pattern to '!**/foo/**' then it works correctly.

but both versions work with glob

@mrmlnc mrmlnc mentioned this issue Nov 10, 2018
10 tasks
@mrmlnc
Copy link
Owner

mrmlnc commented Nov 11, 2018

The previous comment is incorrect.

The micromatch package converts the pattern to RegExp:

/^(?:(?:\.[\\\/](?=.))?(?:(?!\.)(?:(?!(?:[\\\/]|^)\.).)*?[\\\/])?foo[\\\/]?(?!\.)(?:(?!(?:[\\\/]|^)\.).)*?[\\\/]package\.json(?:[\\\/]|$))$/

And…

/^(?:(?:\.[\\\/](?=.))?(?:(?!\.)(?:(?!(?:[\\\/]|^)\.).)*?[\\\/])?foo[\\\/]?(?!\.)(?:(?!(?:[\\\/]|^)\.).)*?[\\\/]package\.json(?:[\\\/]|$))$/.test('packages/foo-foo/package.json')

true

@mrmlnc
Copy link
Owner

mrmlnc commented Nov 11, 2018

I'll take a look at the problem in the micromatch package.

@mrmlnc
Copy link
Owner

mrmlnc commented May 13, 2019

Closing in favor of issue to use micromatch@4 (#154). After upgrade:

[ 'packages/foo-foo/package.json' ]

This issue will be fixed with release fast-glob@3. You can check release issue #181.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants