node-ignore icon indicating copy to clipboard operation
node-ignore copied to clipboard

Warn about files ignoring themselves?

Open jedwards1211 opened this issue 4 years ago • 0 comments

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.

jedwards1211 avatar Nov 30 '20 05:11 jedwards1211