diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -822,7 +822,7 @@ class path_auditor(object): if '.hg' in path.lower(): lparts = [p.lower() for p in parts] for p in '.hg', '.hg.': - if p in lparts[1:-1]: + if p in lparts[1:]: pos = lparts.index(p) base = os.path.join(*parts[:pos]) raise Abort(_('path %r is inside repo %r') % (path, base)) diff --git a/tests/test-walk.out b/tests/test-walk.out --- a/tests/test-walk.out +++ b/tests/test-walk.out @@ -159,7 +159,7 @@ f mammals/Procyonidae/raccoon Procy f mammals/skunk skunk hg debugwalk .hg -.hg: No such file or directory +abort: path 'mammals/.hg' is inside repo 'mammals' hg debugwalk ../.hg abort: path contains illegal component: .hg @@ -208,7 +208,7 @@ hg debugwalk beans/../.hg/data abort: path contains illegal component: .hg/data hg debugwalk beans/.hg -beans/.hg: No such file or directory +abort: path 'beans/.hg' is inside repo 'beans' hg debugwalk glob:* f fennel fennel