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
128 let value = value.into();128 let value = value.into();
129 match self.first_wildcard_pos {129 match self.first_wildcard_pos {
130 // "*literal" case, overrides starts-with130 // "*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 {
132 let text = &self.text[pos + 1..];135 let text = &self.text[pos + 1..];
133 if mode.contains(wildmatch::Mode::IGNORE_CASE) {136 if mode.contains(wildmatch::Mode::IGNORE_CASE) {
134 value137 value