Skip to content

Commit b0ee841

Browse files
authored
Don't use a regex in IsImplicitGlob (#1482)
1 parent 62a8b89 commit b0ee841

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

internal/vfs/utilities.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,10 @@ func replaceWildcardCharacter(match string, singleAsteriskRegexFragment string)
7575
}
7676
}
7777

78-
var isImplicitGlobRegex = regexp2.MustCompile(`[.*?]`, regexp2.None)
79-
8078
// An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension,
8179
// and does not contain any glob characters itself.
8280
func IsImplicitGlob(lastPathComponent string) bool {
83-
match, err := isImplicitGlobRegex.MatchString(lastPathComponent)
84-
if err != nil {
85-
return false
86-
}
87-
return !match
81+
return !strings.ContainsAny(lastPathComponent, ".*?")
8882
}
8983

9084
// Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.

0 commit comments

Comments
 (0)