History

fix: be sure to allow `ENDS_WITH` optimization if shellglobs are enabled

Sebastian Thiel committed 3 years ago

Commit ddb593b1 parent c35ddab1 file · +4 −1Browse files

Unified · Split

gix-glob/src/pattern.rs+4−1
@@ -128,7 +128,10 @@ impl Pattern { · 127 unmodified lines
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