mercurial/match.py
changeset 42864 72890d8f9860
parent 42766 e94c8f584ee2
child 43076 2372284d9457
--- a/mercurial/match.py	Mon Aug 26 08:25:01 2019 -0400
+++ b/mercurial/match.py	Sun Aug 25 22:53:42 2019 -0400
@@ -1223,7 +1223,12 @@
         # Anything after the pattern must be a non-directory.
         return escaped + '[^/]+$'
     if kind == 'relglob':
-        return '(?:|.*/)' + _globre(pat) + globsuffix
+        globre = _globre(pat)
+        if globre.startswith('[^/]*'):
+            # When pat has the form *XYZ (common), make the returned regex more
+            # legible by returning the regex for **XYZ instead of **/*XYZ.
+            return '.*' + globre[len('[^/]*'):] + globsuffix
+        return '(?:|.*/)' + globre + globsuffix
     if kind == 'relre':
         if pat.startswith('^'):
             return pat