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>2014-02-17 08:02:05 +0400
committerisaacs <i@izs.me>2014-02-17 08:02:05 +0400
commit50d4cca7a76dd16bd09a231f3a53ff2d45238ac5 (patch)
tree976ac8914669d988784cb52f0d5bba0b7b893e0f /node_modules/glob
parent550e38cc46c9e00c82b46858746be50a99cf955d (diff)
glob: revert to 3.2.7 to avoid mark:true regression
Diffstat (limited to 'node_modules/glob')
-rw-r--r--node_modules/glob/glob.js74
-rw-r--r--node_modules/glob/package.json6
-rw-r--r--node_modules/glob/test/mark.js8
3 files changed, 35 insertions, 53 deletions
diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js
index f4c69e973..7903be18f 100644
--- a/node_modules/glob/glob.js
+++ b/node_modules/glob/glob.js
@@ -214,10 +214,27 @@ Glob.prototype._finish = function () {
all = all.sort(this.nocase ? alphasorti : alphasort)
}
+ if (this.mark) {
+ // at *some* point we statted all of these
+ all = all.map(function (m) {
+ var sc = this.cache[m]
+ if (!sc)
+ return m
+ var isDir = (Array.isArray(sc) || sc === 2)
+ if (isDir && m.slice(-1) !== "/") {
+ return m + "/"
+ }
+ if (!isDir && m.slice(-1) === "/") {
+ return m.replace(/\/+$/, "")
+ }
+ return m
+ }, this)
+ }
+
this.log("emitting end", all)
this.EOF = this.found = all
- this.emitMatch(this.EOF, -1)
+ this.emitMatch(this.EOF)
}
function alphasorti (a, b) {
@@ -253,47 +270,16 @@ Glob.prototype.resume = function () {
//process.nextTick(this.emit.bind(this, "resume"))
}
-Glob.prototype._mark = function (p) {
- var c = this.cache[p]
- var m = p
- if (c) {
- var isDir = c === 2 || Array.isArray(c)
- var slash = p.slice(-1) === '/'
-
- if (isDir && !slash)
- m += '/'
- else if (!isDir && slash)
- m = m.slice(0, -1)
-
- if (m !== p) {
- this.statCache[m] = this.statCache[p]
- this.cache[m] = this.cache[p]
- }
- }
-
- return m
-}
-
-Glob.prototype._pushMatch = function(m, index) {
- if (this.mark && m !== this.EOF)
- m = this._mark(m)
-
- if (m !== this.EOF) {
- this.matches[index] = this.matches[index] || {}
- this.matches[index][m] = true
- }
-
- this._emitQueue.push(m)
- this._processEmitQueue()
-}
-
-Glob.prototype.emitMatch = function (m, index) {
- if ((!this.stat && !this.mark) || this.statCache[m] || m === this.EOF) {
- this._pushMatch(m, index)
+Glob.prototype.emitMatch = function (m) {
+ if (!this.stat || this.statCache[m] || m === this.EOF) {
+ this._emitQueue.push(m)
+ this._processEmitQueue()
} else {
this._stat(m, function(exists, isDir) {
- if (exists)
- this._pushMatch(m, index)
+ if (exists) {
+ this._emitQueue.push(m)
+ this._processEmitQueue()
+ }
})
}
}
@@ -367,7 +353,9 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
if (process.platform === "win32")
prefix = prefix.replace(/\\/g, "/")
- this.emitMatch(prefix, index)
+ this.matches[index] = this.matches[index] || {}
+ this.matches[index][prefix] = true
+ this.emitMatch(prefix)
}
return cb()
})
@@ -481,7 +469,9 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
if (process.platform === "win32")
e = e.replace(/\\/g, "/")
- this.emitMatch(e, index)
+ this.matches[index] = this.matches[index] || {}
+ this.matches[index][e] = true
+ this.emitMatch(e)
}, this)
return cb.call(this)
}
diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json
index 8cd18eaf6..59b75afe3 100644
--- a/node_modules/glob/package.json
+++ b/node_modules/glob/package.json
@@ -6,7 +6,7 @@
},
"name": "glob",
"description": "a little globber",
- "version": "3.2.8",
+ "version": "3.2.7",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
@@ -34,6 +34,6 @@
"url": "https://github.com/isaacs/node-glob/issues"
},
"homepage": "https://github.com/isaacs/node-glob",
- "_id": "glob@3.2.8",
- "_from": "glob@~3.2.6"
+ "_id": "glob@3.2.7",
+ "_from": "glob@3.2.7"
}
diff --git a/node_modules/glob/test/mark.js b/node_modules/glob/test/mark.js
index e74282073..ed68a335c 100644
--- a/node_modules/glob/test/mark.js
+++ b/node_modules/glob/test/mark.js
@@ -18,8 +18,6 @@ test("mark, no / on pattern", function (t) {
t.same(results, expect)
t.end()
- }).on('match', function(m) {
- t.similar(m, /\/$/)
})
})
@@ -38,8 +36,6 @@ test("mark=false, no / on pattern", function (t) {
expect.push('a/symlink')
t.same(results, expect)
t.end()
- }).on('match', function(m) {
- t.similar(m, /[^\/]$/)
})
})
@@ -57,8 +53,6 @@ test("mark=true, / on pattern", function (t) {
expect.push('a/symlink/')
t.same(results, expect)
t.end()
- }).on('match', function(m) {
- t.similar(m, /\/$/)
})
})
@@ -76,7 +70,5 @@ test("mark=false, / on pattern", function (t) {
expect.push('a/symlink/')
t.same(results, expect)
t.end()
- }).on('match', function(m) {
- t.similar(m, /\/$/)
})
})