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

minimatch('tmp/public/app/css/main.css', 'tmp/*') #8

Closed
kof opened this issue May 4, 2012 · 5 comments
Closed

minimatch('tmp/public/app/css/main.css', 'tmp/*') #8

kof opened this issue May 4, 2012 · 5 comments

Comments

@kof
Copy link

kof commented May 4, 2012

resolves as false .... I suppose this should result true

@isaacs
Copy link
Owner

isaacs commented May 4, 2012

* doesn't ever match /.

Try tmp/**.

@isaacs isaacs closed this as completed May 4, 2012
@isaacs
Copy link
Owner

isaacs commented May 4, 2012

Same as bash:

$ mkdir -p tmp/foo/bar

$ echo tmp/*
tmp/foo

$ echo tmp/**
tmp/ tmp/foo tmp/foo/bar

@kof
Copy link
Author

kof commented May 4, 2012

hmmm, why is then .gitignore working using 'tmp/*' or even 'tmp' ?

@isaacs
Copy link
Owner

isaacs commented May 4, 2012

Because when you .gitignore a folder, it doesn't even bother to traverse it at all.

You cannot get the .gitignore-style behavior by making a list of every file and then glob-matching each one. For starters, that's ludicrously expensive (you may have a .gitignore'd folder with 100000 files in it or something), and also, you have to keep track of whether the parent was ignored. However, it gets more complicated, because a rule might cause you to have to look for specific items, if they're un-ignored with a negated rule.

I wrote fstream-ignorefile specifically for this use case. If you find a situation where it fails to include/exclude a file that git would, then please let me know.

@kof
Copy link
Author

kof commented May 4, 2012

Thanks, I will propose this to nodejitsu/forever guys, they are just using minimatch and caused a lot of pain for me today :)

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

No branches or pull requests

2 participants