Skip to content

Commit deaa0d4

Browse files
committed
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: #198
1 parent ce9e6a4 commit deaa0d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ export class Minimatch {
558558
} else if (
559559
a[ai] === '*' &&
560560
b[bi] &&
561-
!b[bi].startsWith('.') &&
561+
(this.options.dot || !b[bi].startsWith('.')) &&
562562
b[bi] !== '**'
563563
) {
564564
if (which === 'b') return false
@@ -763,6 +763,9 @@ export class Minimatch {
763763
// non-magic patterns just have to match exactly
764764
// patterns with magic have been turned into regexps.
765765
let hit: boolean
766+
while (f === '.' && fi < fl - 1) {
767+
f = file[++fi]
768+
}
766769
if (typeof p === 'string') {
767770
hit = f === p
768771
this.debug('string match', p, f, hit)

0 commit comments

Comments
 (0)