[glob] {**/package.json,**/project.json} matches too much (fixes #9917)
This commit is contained in:
parent
9bf7c18e49
commit
6e81c92e9b
|
@ -207,14 +207,14 @@ function parseRegExp(pattern: string): string {
|
|||
}
|
||||
|
||||
// regexes to check for trival glob patterns that just check for String#endsWith
|
||||
const T1 = /^\*\*\/\*\.[\w\.-]+$/; // **/*.something
|
||||
const T2 = /^\*\*\/[\w\.-]+$/; // **/something
|
||||
const T3 = /^{\*\*\/\*\.[\w\.-]+(,\*\*\/\*\.[\w\.-]+)*}$/; // {**/*.something,**/*.else}
|
||||
const T1 = /^\*\*\/\*\.[\w\.-]+$/; // **/*.something
|
||||
const T2 = /^\*\*\/[\w\.-]+$/; // **/something
|
||||
const T3 = /^{\*\*\/[\*\.]?[\w\.-]+(,\*\*\/[\*\.]?[\w\.-]+)*}$/; // {**/*.something,**/*.else} or {**/package.json,**/project.json}
|
||||
|
||||
enum Trivia {
|
||||
T1, // **/*.something
|
||||
T2, // **/something
|
||||
T3 // {**/*.something,**/*.else}
|
||||
T3, // {**/*.something,**/*.else} or {**/package.json,**/project.json}
|
||||
}
|
||||
|
||||
interface IParsedPattern {
|
||||
|
|
|
@ -291,6 +291,12 @@ suite('Glob', () => {
|
|||
assert(!glob.match(p, 'some/test/tempting'));
|
||||
assert(!glob.match(p, 'some\\test\\tempting'));
|
||||
assert(!glob.match(p, 'C:\\\\some\\test\\tempting'));
|
||||
|
||||
p = '{**/package.json,**/project.json}';
|
||||
assert(glob.match(p, 'package.json'));
|
||||
assert(glob.match(p, '/package.json'));
|
||||
assert(!glob.match(p, 'xpackage.json'));
|
||||
assert(!glob.match(p, '/xpackage.json'));
|
||||
});
|
||||
|
||||
test('brace expansion', function () {
|
||||
|
|
Loading…
Reference in a new issue