Closed danielo515 closed 2 years ago
Hello, thanks for this library. I think I found a problem. Given this gitignore file:
coverage node_modules# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variables file .env .env.test .env.production # parcel-bundler cache (https://parceljs.org/) .cache .parcel-cache # Next.js build output .next out # Nuxt.js build / generate output .nuxt dist # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js # https://nextjs.org/blog/next-9-1#public-directory-support # public # vuepress build output .vuepress/dist # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # yarn v2 .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.*
The library is returning me false when I check ig.ignores('node_modules'), but it should return true. This is how I test it:
ig.ignores('node_modules')
ignore = require('ignore') ig = ignore().add(fs.readFileSync('.gitignore','utf8')) ig.ignores('node_modules') // => says false
If I check using git, indeed the folder is ignored:
➜ git check-ignore -v node_modules .gitignore:43:node_modules/ node_modules
I know this line is not strictly correct:
node_modules# Logs
but if git is telling me that the folder is ignored, I think this library should too
I've added a test case which is passed (see here), and I think the issue is invalid.
And in your ignore file
... node_modules# Logs <--- this does NOT ignore the folder ... # Dependency directories node_modules/ <--- this ignores the folder ...
Hello, thanks for this library. I think I found a problem. Given this gitignore file:
The library is returning me false when I check
ig.ignores('node_modules')
, but it should return true. This is how I test it:If I check using git, indeed the folder is ignored: