Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-06-26 01:19:25 +0400
committerisaacs <i@izs.me>2011-06-26 01:19:45 +0400
commit0844b25fd8a101029f9d978752708b87ec8a56f2 (patch)
treebd081e3063e35a10920112a43ae98432b86804ec
parentb637ad6196e9d68b3f74acafa4e195b9e816385a (diff)
Close #1078 Don't be confused by './' in 'files' list
This actually affected any .gitignore/.npmignore line that starts with '!./', which is how the 'files' list is handled internally.
-rw-r--r--lib/utils/excludes.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/utils/excludes.js b/lib/utils/excludes.js
index 960e6d1b5..0c76846e3 100644
--- a/lib/utils/excludes.js
+++ b/lib/utils/excludes.js
@@ -102,8 +102,8 @@ function test (file, excludeList) {
for (var ii = 0, ll = excludes.length; ii < ll; ii ++) {
//log.warn(JSON.stringify(excludes[ii]), "ex")
- var ex = excludes[ii].replace(/^\.\//, "")
- , inc = ex.match(incRe)
+ var ex = excludes[ii].replace(/^(!*)\.\//, "$1")
+ , inc = !!ex.match(incRe)
// excluding/including a dir excludes/includes all the files in it.
if (ex.slice(-1) === "/") ex += "**"
@@ -112,14 +112,23 @@ function test (file, excludeList) {
// excluded it, then just continue, because there's nothing
// that can be done here to change the exclusion.
if (!inc && excluded) continue
+
+ // if it's an inclusion attempt, and the file has not been
+ // excluded, then skip it, because there's no need to try again.
if (inc && !excluded) continue
// if it matches the pattern, then it should be excluded.
- excluded = minimatch(rf, ex)
+ excluded = !!minimatch(rf, ex)
+ //if (inc) excluded = !excluded
+
+ //if (excluded) {
+ // console.error("excluded %s %s", rf, ex)
+ //}
// if you include foo, then it also includes foo/bar.js
if (inc && excluded && ex.slice(-3) !== "/**") {
excluded = minimatch(rf, ex + "/**")
+ // console.error(rf, ex + "/**", inc, excluded)
}
}
//log.warn([rf, excluded, excludes], "file, excluded, excludes")