[Updated] D8507: rust-regex: prevent nonsensical `.*.*` pattern from happening
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Wed May 13 00:24:24 UTC 2020
Closed by commit rHGdbc2dcbdd177: rust-regex: prevent nonsensical `.*.*` pattern from happening (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8507?vs=21325&id=21369
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8507/new/
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
@@ -181,7 +181,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, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200513/319893c2/attachment-0002.html>
More information about the Mercurial-patches
mailing list