[Request] [+ ] D8507: rust-regex: prevent nonsensical `.*.*` pattern from happening
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Thu May 7 22:16:55 UTC 2020
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D8507
AFFECTED FILES
rust/hg-core/src/filepatterns.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/filepatterns.rs b/rust/hg-core/src/filepatterns.rs
--- a/rust/hg-core/src/filepatterns.rs
+++ b/rust/hg-core/src/filepatterns.rs
@@ -189,7 +189,10 @@
// The `regex` crate accepts `**` while `re2` and Python's `re`
// do not. Checking for `*` correctly triggers the same error all
// engines.
- if pattern[0] == b'^' || pattern[0] == b'*' {
+ if pattern[0] == b'^'
+ || pattern[0] == b'*'
+ || pattern.starts_with(b".*")
+ {
return pattern.to_owned();
}
[&b".*"[..], pattern].concat()
To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200507/3864d650/attachment-0001.html>
More information about the Mercurial-patches
mailing list