Skip to content

Commit

Permalink
fix: disallow child going against parent ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mohd-akram committed Nov 24, 2023
1 parent 12a7c00 commit a642e24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ class Walker extends EE {
included = this.parent.filterEntry(pt, partial)
}

if (!included) {
return false
}

this.ignoreFiles.forEach(f => {
if (this.ignoreRules[f]) {
this.ignoreRules[f].forEach(rule => {
Expand Down
6 changes: 2 additions & 4 deletions test/nested-ignores.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const path = resolve(__dirname, 'fixtures')
// set the ignores just for this test
var c = require('./common.js')
c.ignores({
'.ignore': ['*', 'd', 'h', '!d/c/h/.dch', '!/h/c/d/hcd'],
'.ignore': ['*', '!c', 'd', 'h', '!d/c/h/.dch', '!/h/c/d/hcd'],
'c/.ignore': ['*'], // ignore everything
'd/.ignore': ['!*', '.ignore'], // unignore everything
'd/d/.ignore': ['*'], // re-ignore everything
'd/c/.ignore': ['*', '!/h/.dch'], // original unignore
Expand All @@ -18,9 +19,6 @@ c.ignores({
// the only files we expect to see
var expected = [
'd/c/h/.dch',
'h/c/d/.hcd',
'h/c/d/dch',
'h/c/d/ddd',
'h/c/d/hcd',
]

Expand Down

0 comments on commit a642e24

Please sign in to comment.