diff mercurial/commands.py @ 44849:f90957c947f4

grep: don't go in an infinite loop when given empty regex Differential Revision: https://phab.mercurial-scm.org/D8543
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Sun, 17 May 2020 12:52:43 -0400
parents 6d3768b11241
children 8d552701806d
line wrap: on
line diff
--- a/mercurial/commands.py	Sun May 17 12:49:12 2020 -0400
+++ b/mercurial/commands.py	Sun May 17 12:52:43 2020 -0400
@@ -3428,8 +3428,11 @@
                 m = regexp.search(self.line, p)
                 if not m:
                     break
-                yield m.span()
-                p = m.end()
+                if m.end() == p:
+                    p += 1
+                else:
+                    yield m.span()
+                    p = m.end()
 
     matches = {}
     copies = {}