[glob] {**/package.json,**/project.json} matches too much (fixes #9917)

This commit is contained in:
Benjamin Pasero 2016-08-08 11:31:02 +02:00
parent 9bf7c18e49
commit 6e81c92e9b
2 changed files with 10 additions and 4 deletions

View file

@ -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 {

View file

@ -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 () {