audit: check for casefolding of .hg (
issue1450)
--- a/mercurial/util.py Mon Feb 16 17:37:23 2009 -0600
+++ b/mercurial/util.py Mon Feb 16 17:37:23 2009 -0600
@@ -815,13 +815,15 @@
return
normpath = os.path.normcase(path)
parts = splitpath(normpath)
- if (os.path.splitdrive(path)[0] or parts[0] in ('.hg', '.hg.', '')
+ if (os.path.splitdrive(path)[0]
+ or parts[0].lower() in ('.hg', '.hg.', '')
or os.pardir in parts):
raise Abort(_("path contains illegal component: %s") % path)
- if '.hg' in path:
+ if '.hg' in path.lower():
+ lparts = [p.lower() for p in parts]
for p in '.hg', '.hg.':
- if p in parts[1:-1]:
- pos = parts.index(p)
+ if p in lparts[1:-1]:
+ pos = lparts.index(p)
base = os.path.join(*parts[:pos])
raise Abort(_('path %r is inside repo %r') % (path, base))
def check(prefix):