minimatch
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -920,2 +920,5 @@ ;(function (require, exports, module, platform) { | ||
if (p === GLOBSTAR) { | ||
if (options.debug) | ||
console.error('GLOBSTAR', [pattern, p, f]) | ||
// "**" | ||
@@ -932,3 +935,4 @@ // a/**/b/**/c would match the following: | ||
// This is recursively awful. | ||
// a/b/x/y/z/c | ||
// | ||
// a/**/b/**/c matching a/b/x/y/z/c | ||
// - a matches a | ||
@@ -946,2 +950,4 @@ // - doublestar | ||
if (pr === pl) { | ||
if (options.debug) | ||
console.error('** at the end') | ||
// a ** at the end will just swallow the rest. | ||
@@ -963,6 +969,6 @@ // We have found a match. | ||
var swallowee = file[fr] | ||
if (swallowee === "." || swallowee === ".." || | ||
(!options.dot && swallowee.charAt(0) === ".")) { | ||
// console.error("dot detected!") | ||
break WHILE | ||
if (options.debug) { | ||
console.error('\nglobstar while', | ||
file, fr, pattern, pr, swallowee) | ||
} | ||
@@ -972,6 +978,19 @@ | ||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { | ||
if (options.debug) | ||
console.error('globstar found match!', fr, fl, swallowee) | ||
// found a match. | ||
return true | ||
} else { | ||
// can't swallow "." or ".." ever. | ||
// can only swallow ".foo" when explicitly asked. | ||
if (swallowee === "." || swallowee === ".." || | ||
(!options.dot && swallowee.charAt(0) === ".")) { | ||
if (options.debug) | ||
console.error("dot detected!", file, fr, pattern, pr) | ||
break WHILE | ||
} | ||
// ** swallows a segment, and continue. | ||
if (options.debug) | ||
console.error('globstar swallow a segment, and continue') | ||
fr ++ | ||
@@ -978,0 +997,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "a glob matcher in javascript", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -234,2 +234,26 @@ // http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test | ||
// https://github.com/isaacs/minimatch/issues/5 | ||
, function () { | ||
files = [ 'a/b/.x/c' | ||
, 'a/b/.x/c/d' | ||
, 'a/b/.x/c/d/e' | ||
, 'a/b/.x' | ||
, 'a/b/.x/' | ||
, 'a/.x/b' | ||
, '.x' | ||
, '.x/' | ||
, '.x/a' | ||
, '.x/a/b' | ||
, 'a/.x/b/.x/c' | ||
, '.x/.x' ] | ||
} | ||
, ["**/.x/**", [ '.x/' | ||
, '.x/a' | ||
, '.x/a/b' | ||
, 'a/.x/b' | ||
, 'a/b/.x/' | ||
, 'a/b/.x/c' | ||
, 'a/b/.x/c/d' | ||
, 'a/b/.x/c/d/e' ] ] | ||
].forEach(function (c) { | ||
@@ -236,0 +260,0 @@ if (typeof c === "function") return c() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58380
1452