node-ignore
node-ignore copied to clipboard
Warn about files ignoring themselves?
Another silly edge case. Unsurprisingly, it seems a .gitignore
file can't ignore itself, but it can ignore other .gitignore
files. For example the rule .gitignore
won't ignore the file containing it, but it will ignore .gitignore
files in subdirectories.
Since ignore
only deals with rules, if one naively loads all the rules from a .gitignore
file into it, ignore
will think that .gitignore
file is itself ignored. Especially in the worst case that there is a *
rule followed by negative rules, but not !.gitignore
.
I think we should add a warnings section to the README about pitfalls like this.