diff options
author | isaacs <i@izs.me> | 2011-06-22 00:28:26 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-06-22 00:37:03 +0400 |
commit | 4c84a132f272d8a700a6ebbf5ebfc9c2d28ffb31 (patch) | |
tree | cde529b6dda23322ddf53bd49f1c667cba691a93 | |
parent | cecf47116e57f3bf84844a0e6f29e8885f06df35 (diff) |
Close #1059 Head-slappingly stupid regexp bug.
It seems that Zombie is the only package using the "files" array
seriously.
I'm so sorry. This is not the worst bug ever, not even the worst bug in
npm ever, but it may be the most embarrassing.
-rw-r--r-- | lib/utils/excludes.js | 8 | ||||
-rw-r--r-- | lib/utils/minimatch.js | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/utils/excludes.js b/lib/utils/excludes.js index f12f15bc0..960e6d1b5 100644 --- a/lib/utils/excludes.js +++ b/lib/utils/excludes.js @@ -106,15 +106,21 @@ function test (file, excludeList) { , inc = ex.match(incRe) // excluding/including a dir excludes/includes all the files in it. - if (ex.slice(-1) === "/") ex += "*" + if (ex.slice(-1) === "/") ex += "**" // if this is not an inclusion attempt, and someone else // excluded it, then just continue, because there's nothing // that can be done here to change the exclusion. if (!inc && excluded) continue + if (inc && !excluded) continue // if it matches the pattern, then it should be excluded. excluded = minimatch(rf, ex) + + // if you include foo, then it also includes foo/bar.js + if (inc && excluded && ex.slice(-3) !== "/**") { + excluded = minimatch(rf, ex + "/**") + } } //log.warn([rf, excluded, excludes], "file, excluded, excludes") } diff --git a/lib/utils/minimatch.js b/lib/utils/minimatch.js index 5f6cb01f3..d42362b7b 100644 --- a/lib/utils/minimatch.js +++ b/lib/utils/minimatch.js @@ -217,7 +217,7 @@ function makeRe (pattern) { re = "^" + re + "$" // fail on the pattern, but allow anything otherwise. - if (negate) re = "^(!?" + re + ").*$" + if (negate) re = "^(?!" + re + ").*$" return new RegExp(re) } |