gitignore-parser icon indicating copy to clipboard operation
gitignore-parser copied to clipboard

A simple .gitignore parser for node.js

Results 7 gitignore-parser issues
Sort by recently updated
recently updated
newest added

Despite have node_modules ignore in my .gitignore, other folders called node_modules deeper in the directory structure are accepted. This is a very common use case in monorepos.

https://git-scm.com/docs/gitignore#_pattern_format > If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore...

Added tests that show deep paths are not working currently. Sorry for being all over the place. Cool lib btw!

``` var gitignore = parser.compile('/ajax/libs/bPopup/*b*'); console.log(gitignore.accepts('/ajax/libs/bPopup/0.9.0')); //output false var gitignore = parser.compile('/ajax/libs/jquery-form-validator/2.2'); console.log(gitignore.accepts('/ajax/libs/jquery-form-validator/2.2.43')); //output false var gitignore = parser.compile('/ajax/libs/punycode/2.0'); console.log(gitignore.accepts('/ajax/libs/punycode/2.0.0')); //output false var gitignore = parser.compile('/ajax/libs/typescript/*dev*'); console.log(gitignore.accepts('/ajax/libs/typescript/2.0.6-insiders.20161014')); //output false ```

``` javascript var parser = require('gitignore-parser').compile('package'); parser.accepts('package.json'); // false ``` I would think that `package.json` should still be accepted since git CLI would not ignore that file with that `.gitignore`.

If I `compile('foo.txt')`, it should `accept('foo.txt')`, but doesn't. It also does not `accept('a/foo.txt')`.