Skip to content

Commit ddb593b

Browse files
committed
fix: be sure to allow ENDS_WITH optimization if shellglobs are enabled
1 parent c35ddab commit ddb593b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gix-glob/src/pattern.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ impl Pattern {
128128
let value = value.into();
129129
match self.first_wildcard_pos {
130130
// "*literal" case, overrides starts-with
131-
Some(pos) if self.mode.contains(pattern::Mode::ENDS_WITH) && !value.contains(&b'/') => {
131+
Some(pos)
132+
if self.mode.contains(pattern::Mode::ENDS_WITH)
133+
&& (!mode.contains(wildmatch::Mode::NO_MATCH_SLASH_LITERAL) || !value.contains(&b'/')) =>
134+
{
132135
let text = &self.text[pos + 1..];
133136
if mode.contains(wildmatch::Mode::IGNORE_CASE) {
134137
value

0 commit comments

Comments
 (0)