-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filter out consecutive ** more efficiently
Previously, consecutive globstars were being properly stripped out of makeRe, but leaving them in there in the normal minimatch set geometrically increases the amount of work that has to be done when glob gets a pattern like 'a/**/**/b'. Better to strip them out from the initial pattern, and never have to worry about it again.
- Loading branch information
Showing
2 changed files
with
42 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const t = require('tap') | ||
const {Minimatch, GLOBSTAR} = require('../') | ||
|
||
const patterns = [] | ||
for (const a of ['**', '**/**', '**/**/**']) { | ||
for (const b of['**', '**/**', '**/**/**']) { | ||
for (const c of ['**', '**/**', '**/**/**']) { | ||
patterns.push(`x/${a}/y/${b}/z/${c}`) | ||
} | ||
} | ||
} | ||
|
||
for (const m of patterns.map(p => new Minimatch(p))) { | ||
t.same(m.globParts, [['x', '**', 'y', '**', 'z', '**']]) | ||
} |