# HG changeset patch # User Matt Mackall # Date 1234827443 21600 # Node ID 8a217626bb0c4e36c41427fc2825988d700a9442 # Parent 2c5b2abfb8be4e0cb286a5420ffc0f7b585103b3 audit: check for casefolding of .hg (issue1450) diff -r 2c5b2abfb8be -r 8a217626bb0c mercurial/util.py --- 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):