Patchwork D8508: rust-regex: fix support for verbatim `re:` syntax

login
register
mail settings
Submitter phabricator
Date May 7, 2020, 10:17 p.m.
Message ID <differential-rev-PHID-DREV-vc7hbjzu464zs4fdwroo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46291/
State Superseded
Headers show

Comments

phabricator - May 7, 2020, 10:17 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There was no test to bring this (and consequently the previous anchoring fixes)
  to my attention, so I added one.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8508

AFFECTED FILES
  rust/hg-core/src/filepatterns.rs
  tests/test-hgignore.t

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t
--- a/tests/test-hgignore.t
+++ b/tests/test-hgignore.t
@@ -28,6 +28,18 @@ 
 
   $ rm foo bar baz .hgignore makeignore.py
 
+test verbatim "re:" patterns
+
+  $ touch test
+  $ touch test2  # don't anchor the end
+  $ mkdir a
+  $ touch a/test # don't anchor the start either
+  $ echo "re:test" > .hgignore
+  $ hg status
+  ? .hgignore
+  $ rm test test2 a/test .hgignore
+  $ rmdir a
+
   $ touch a.o
   $ touch a.c
   $ touch syntax
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
@@ -312,7 +312,7 @@ 
     static ref SYNTAXES: FastHashMap<&'static [u8], &'static [u8]> = {
         let mut m = FastHashMap::default();
 
-        m.insert(b"re".as_ref(), b"relre:".as_ref());
+        m.insert(b"re".as_ref(), b"re:".as_ref());
         m.insert(b"regexp".as_ref(), b"relre:".as_ref());
         m.insert(b"glob".as_ref(), b"relglob:".as_ref());
         m.insert(b"rootglob".as_ref(), b"rootglob:".as_ref());