Unified · Split
| @@ -375,15 +375,22 @@ impl<'repo> delegate::Navigate for Delegate<'repo> { · 374 unmodified lines | ||
| 375 | 375 | #[cfg(not(feature = "regex"))] |
| 376 | 376 | let matches = |message: &BStr| -> bool { message.contains_str(regex) }; |
| 377 | 377 | #[cfg(feature = "regex")] |
| 378 | − let compiled_regex = match regex::bytes::Regex::new(regex.to_str_lossy().as_ref()) { | |
| 379 | − Ok(regex) => regex, | |
| 378 | + let matches = match regex::bytes::Regex::new(regex.to_str_lossy().as_ref()) { | |
| 379 | + Ok(compiled) => { | |
| 380 | + let needs_regex = regex::escape(compiled.as_str()) != regex; | |
| 381 | + move |message: &BStr| -> bool { | |
| 382 | + if needs_regex { | |
| 383 | + compiled.is_match(message) | |
| 384 | + } else { | |
| 385 | + message.contains_str(regex) | |
| 386 | + } | |
| 387 | + } | |
| 388 | + } | |
| 380 | 389 | Err(err) => { |
| 381 | 390 | self.err.push(err.into()); |
| 382 | 391 | return None; |
| 383 | 392 | } |
| 384 | 393 | }; |
| 385 | − #[cfg(feature = "regex")] | |
| 386 | − let matches = move |message: &BStr| -> bool { compiled_regex.is_match(message) }; | |
| 387 | 394 | |
| 388 | 395 | match self.objs[self.idx].as_mut() { |
| 389 | 396 | Some(objs) => { |
| @@ -29,6 +29,11 @@ impl<'repo> Platform<'repo> { · 28 unmodified lines | ||
| 29 | 29 | /// Produce the iterator |
| 30 | 30 | impl<'repo> Platform<'repo> { |
| 31 | 31 | /// Return an iterator to traverse all commits reachable as configured by the [Platform]. |
| 32 | + /// | |
| 33 | + /// # Performance | |
| 34 | + /// | |
| 35 | + /// It's highly recommended to set an [`object cache`][Repository::object_cache_size()] on the parent repo | |
| 36 | + /// to greatly speed up performance if the returned id is supposed to be looked up right after. | |
| 32 | 37 | pub fn all(self) -> Result<revision::Walk<'repo>, git_traverse::commit::ancestors::Error> { |
| 33 | 38 | let Platform { |
| 34 | 39 | repo, |