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

Question about ignore patterns #107

Closed
keenwon opened this issue May 15, 2018 · 3 comments
Closed

Question about ignore patterns #107

keenwon opened this issue May 15, 2018 · 3 comments
Assignees

Comments

@keenwon
Copy link

keenwon commented May 15, 2018

Environment

  • OS Version: Manjaro Linux x86_64 ( 4.14.39-1-MANJARO )
  • Node.js Version: v9.7.1

Steps to reproduce & Code sample

src directory

├── a.js
└── lib
    └── b.js
const fg = require('fast-glob');
const glob = require('glob');

const files = 'src/**/*';
const ignore = ['src/lib/*'];

const fileList1 = fg.sync(files, {
  cwd: '/test',
  ignore,
  onlyFiles: true,
  absolute: true
});

const fileList2 = glob.sync(files, {
  cwd: '/test',
  ignore,
  nodir: true,
  absolute: true
});


console.log('fast-glob:');
console.log(fileList1);
console.log('glob:');
console.log(fileList2);

/**
fast-glob:
[ '/test/src/a.js',
  '/test/src/lib/b.js' ]
glob:
[ '/test/src/a.js' ]
*/

Actual behavior

match [ '/test/src/a.js', '/test/src/lib/b.js' ]

Expected behavior

match [ '/test/src/a.js' ]

@mrmlnc
Copy link
Owner

mrmlnc commented May 15, 2018

Looks like a bug! Thanks for report 🌮

@mrmlnc
Copy link
Owner

mrmlnc commented May 15, 2018

A little bit about how this happened.

In the convertPatternGroupsToTasks function we try to find all negative patterns that equals to base path of each positive pattern. But in this case the positive pattern has a base path: /test/src. At the same time, the negative pattern has a base path: /test/src/lib.

@mrmlnc
Copy link
Owner

mrmlnc commented May 15, 2018

I will publish a fix to this issue today (#109).

@mrmlnc mrmlnc closed this as completed May 15, 2018
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