diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -386,7 +386,8 @@ class icasefsmatcher(match): 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 @@ class icasefsmatcher(match): 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 diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -232,9 +232,17 @@ and OS X -xyz +def + $ hg mv CapsDir1/CapsDir/abc.txt CapsDir1/CapsDir/ABC.txt + moving CapsDir1/CapsDir/AbC.txt to CapsDir1/CapsDir/ABC.txt (glob) + $ hg ci -m "case changing rename" CapsDir1/CapsDir/AbC.txt CapsDir1/CapsDir/ABC.txt + + $ hg status -A capsdir1/capsdir + M CapsDir1/CapsDir/SubDir/Def.txt + C CapsDir1/CapsDir/ABC.txt + $ hg remove -f 'glob:**.txt' -X capsdir1/capsdir $ hg remove -f 'glob:**.txt' -I capsdir1/capsdir - removing CapsDir1/CapsDir/AbC.txt (glob) + removing CapsDir1/CapsDir/ABC.txt (glob) removing CapsDir1/CapsDir/SubDir/Def.txt (glob) #endif