mercurial/match.py
branchstable
changeset 26000 9ac4e81b9659
parent 25875 511e1949d557
child 26014 a5f62af29517
--- a/mercurial/match.py	Thu Aug 06 17:21:46 2015 -0700
+++ b/mercurial/match.py	Thu Aug 06 21:00:16 2015 -0400
@@ -386,7 +386,8 @@
     def __init__(self, root, cwd, patterns, include, exclude, default, auditor,
                  ctx, listsubrepos=False, badfn=None):
         init = super(icasefsmatcher, self).__init__
-        self._dsnormalize = ctx.repo().dirstate.normalize
+        self._dirstate = ctx.repo().dirstate
+        self._dsnormalize = self._dirstate.normalize
 
         init(root, cwd, patterns, include, exclude, default, auditor=auditor,
              ctx=ctx, listsubrepos=listsubrepos, badfn=badfn)
@@ -402,7 +403,13 @@
         kindpats = []
         for kind, pats, source in self._kp:
             if kind not in ('re', 'relre'):  # regex can't be normalized
+                p = pats
                 pats = self._dsnormalize(pats)
+
+                # Preserve the original to handle a case only rename.
+                if p != pats and p in self._dirstate:
+                    kindpats.append((kind, p, source))
+
             kindpats.append((kind, pats, source))
         return kindpats