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

disableGlobbing option: treat glob-like paths as literal paths #598

Merged
merged 5 commits into from
Apr 25, 2017

Conversation

octachrome
Copy link
Contributor

As discussed with @es128 at #300.

Naming options is always tricky, so shout if you have a better suggestion than ignoreGlobs.

If you're happy with the code, I'll update the docs.

@coveralls
Copy link

coveralls commented Apr 21, 2017

Coverage Status

Coverage increased (+0.01%) to 98.405% when pulling c052b75 on octachrome:master into d90d112 on paulmillr:master.

@es128
Copy link
Collaborator

es128 commented Apr 21, 2017

Cool, I'm glad the easy approach seems to work out. Thanks for the PR.

As for the option name, I don't think ignoreGlobs is very clear about the intent. Perhaps disableGlobbing?

Also, if you don't mind, can we add tests showing this working on an individual file, as well as showing that other files that would match the glob pattern (if it were being treated as such) do not get watched.

@coveralls
Copy link

coveralls commented Apr 22, 2017

Coverage Status

Coverage increased (+0.04%) to 98.429% when pulling a94defb on octachrome:master into d90d112 on paulmillr:master.

@octachrome
Copy link
Contributor Author

@es128 I added some more tests - do they address your concerns?

@es128
Copy link
Collaborator

es128 commented Apr 25, 2017

Yes. Thank you, great work!

@es128 es128 merged commit 0faec86 into paulmillr:master Apr 25, 2017
@octachrome octachrome changed the title ignoreGlobs option: treat glob-like paths as literal paths disableGlobbing option: treat glob-like paths as literal paths Apr 26, 2017
@es128 es128 mentioned this pull request May 4, 2017
@DaleMckeown
Copy link

Would I be right in saying that this ignoreGlobs option affects the watcher path only and not any filepaths passed to the ignored option?

I can't seem to get something like this to work - tried with relative and absolte pathing. It always picks up the changes!

Chokidar.watch("../Folder (1)", { disableGlobbing: true, ignored: "bin", ignoreInitial: true, depth: 5 }).on('all', function (event, path) {
    console.log(event);
    console.log(path);
}).on('error', function (error) {
    console.log(error);
});

@octachrome
Copy link
Contributor Author

@DaleMckeown The docs for ignored say "The whole relative or absolute path is tested, not just filename". So you need to use a regex. If you want to ignore files in any subdirectory named bin:

ignored: /\/bin\//,

Or if you only want to ignore files in a directory named bin in your root directory:

ignored: /^\.\.\/Folder \(1\)\/bin\//,

@DaleMckeown
Copy link

@octachrome Ah, thanks! I'll take a look and see if I can get that working tomorrow.

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

Successfully merging this pull request may close these issues.

None yet

4 participants