Subdirectory test case may be incorrect
Closed this issue · 2 comments
gauntface commented
If I have a global gitignore that ignores node_modules/
and I wanted to include one subdirectory, I could do the following in git:
# Do not ignore node_modules
!node_modules
# Ignore all node_modules suddirectories
node_modules/*
# Do not ignore the chalk directory
!node_modules/chalk
I can check this behavior with:
$ git check-ignore --verbose node_modules/jest/README.md
.gitignore:4:node_modules/* node_modules/jest/README.md
$ git check-ignore --verbose node_modules/jest/build/index.js
.gitignore:4:node_modules/* node_modules/jest/build/index.js
$ git check-ignore --verbose node_modules/chalk/readme.md
<no output, indicating the file is not ignored>
$ git check-ignore --verbose node_modules/chalk/source/index.js
<no output, indicating the file is not ignored>
This assertion seems to be at odds with the above behavior:
gauntface commented
I was very much wrong on this libraries behavior vs git check-ignore.
The file should not be ignored (like the test case) but the directory it's in would be ignored, so I need to check both.
nielsbasjes commented
Thanks for diving into this.
If you find any problem I'm happy to pick it up and fix it.
If you happen to find a list of test cases (possibly steps in a git tutorial) I'm happy to include those as additional testcases in my library to ensure it behaves the same as git behaves.