mercurial/scmutil.py
changeset 44858 5d8ae9248a70
parent 44810 62435a5b46fe
child 44884 d044b66d8429
--- a/mercurial/scmutil.py	Mon May 18 16:00:26 2020 -0400
+++ b/mercurial/scmutil.py	Tue May 26 07:03:11 2020 -0400
@@ -803,9 +803,12 @@
 
     if relative:
         cwd = repo.getcwd()
-        pathto = repo.pathto
-        return lambda f: pathto(f, cwd)
-    elif repo.ui.configbool(b'ui', b'slash'):
+        if cwd != b'':
+            # this branch is correct when cwd == b'', ie cwd = repo root,
+            # but it's slower
+            pathto = repo.pathto
+            return lambda f: pathto(f, cwd)
+    if repo.ui.configbool(b'ui', b'slash'):
         return lambda f: f
     else:
         return util.localpath