提交 6e81c92e 编写于 作者: B Benjamin Pasero

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

上级 9bf7c18e
......@@ -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 () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册