Commits

Angel Ezquerra committed a3332b6

reporegistry: show proper short path when common group path ends with slash

A bug would happen if the common group path was a hard drive root, for example.
os.path.normpath() usually removes the trailing slash from a path, but it does
not if the path is a hard drive root (e.g. 'c:\') or a network root (e.g. '\\').

In those cases the short path would be wrong (the first letter would be missing).
This patch fixes that problem.

Comments (0)

Files changed (1)

tortoisehg/hgqt/repotreeitem.py

             spath2 = spath2.lower()
 
         if cpath and spath2.startswith(cpath):
-            iShortPathStart = len(cpath) + 1
+            iShortPathStart = len(cpath)
             spath = spath[iShortPathStart:]
+            if spath and spath[0] in '/\\':
+                # do not show a slash at the beginning of the short path
+                spath = spath[1:]
+
         return hglib.tounicode(spath)
 
     def menulist(self):