gulpjs / glob-stream

Readable streamx interface over anymatch.
MIT License
178 stars 53 forks source link

When dot=true dot files are not removed from negative pattern matches #18

Closed joakimbeng closed 10 years ago

joakimbeng commented 10 years ago

I want to get all files in the current folder, including dot files and excluding all files in a certain subfolder.

Example

What I did:

mkdir globtest
cd globtest
npm install glob-stream
touch .gitignore
touch index.js
mkdir subfolder
touch subfolder/subfile.js

Contents of index.js:

require('glob-stream').create(['**', '!node_modules/**'], {dot: true})
  .on('data', function (file) {
    console.log(file.path);
  });

When I run node . dot files in sub folders to node_modules shows up in the output, when I was expecting only index.js, .gitignore, subfolder and subfolder/subfile.js.

UPDATE When changing the patterns to:

require('glob-stream').create(['**', '!node_modules{,/**,/**/.*}'], {dot: true})
  .on('data', function (file) {
    console.log(file.path);
  });

I get the expected result, feels a little bit weird though. Maybe this belongs in the minimatch repo, what do you think?

yocontra commented 10 years ago

The bug is right here

https://github.com/wearefractal/glob-stream/blob/master/index.js#L15

I'm not passing the minimatch options along - woops! Will have that fixed soon

yocontra commented 10 years ago

Can you test that last commit and see if it solves the problem before I publish?

joakimbeng commented 10 years ago

@contra have tested it now and it indeed works!

yocontra commented 10 years ago

@joakimbeng Cool, I think I published it already so npm update should have you good to go

joakimbeng commented 10 years ago

@contra the repo is still at 3.1.11, so there's nothing to update yet...

yocontra commented 10 years ago

@joakimbeng Sorry about that, done now as 3.1.12