changeset 7784:8a217626bb0c

audit: check for casefolding of .hg (issue1450)
author Matt Mackall <mpm@selenic.com>
date Mon, 16 Feb 2009 17:37:23 -0600
parents 2c5b2abfb8be
children 660c8dd44060
files mercurial/util.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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):