From deaa0d49068879f434f202ea0fd29de8ccafc3b5 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 21 Feb 2023 18:01:28 -0800 Subject: [PATCH 1/2] Ignore ./ at start of filename This is an unintended consequence of optimizing out all the empty path portions from the pattern. People often specify paths as './whatever', and expect a pattern like './*' to match it, which is completely reasonable. Fix: https://github.com/isaacs/minimatch/issues/198 --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 8ef5711c..564c54c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -558,7 +558,7 @@ export class Minimatch { } else if ( a[ai] === '*' && b[bi] && - !b[bi].startsWith('.') && + (this.options.dot || !b[bi].startsWith('.')) && b[bi] !== '**' ) { if (which === 'b') return false @@ -763,6 +763,9 @@ export class Minimatch { // non-magic patterns just have to match exactly // patterns with magic have been turned into regexps. let hit: boolean + while (f === '.' && fi < fl - 1) { + f = file[++fi] + } if (typeof p === 'string') { hit = f === p this.debug('string match', p, f, hit) From 9130c1880391b9416630b050f31f4c0d114e228a Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 21 Feb 2023 18:01:36 -0800 Subject: [PATCH 2/2] 7.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98fd1d17..1a30b542 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "minimatch", - "version": "7.0.0", + "version": "7.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "minimatch", - "version": "7.0.0", + "version": "7.0.1", "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" diff --git a/package.json b/package.json index 2d55c4cb..b6478272 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me)", "name": "minimatch", "description": "a glob matcher in javascript", - "version": "7.0.0", + "version": "7.0.1", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git"