changeset 44358:d52e3826cd4b

pathutil: resurrect comment about path auditing order It was removed at 51c86c6167c1, but expensive symlink traversal isn't the only reason we should walk path components from the root.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 01 Feb 2020 12:57:32 +0900
parents bed8d08cfcb2
children a69c08cdb2a8
files mercurial/pathutil.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pathutil.py	Wed Oct 16 14:12:48 2019 +0200
+++ b/mercurial/pathutil.py	Sat Feb 01 12:57:32 2020 +0900
@@ -100,8 +100,10 @@
         parts.pop()
         normparts.pop()
         # It's important that we check the path parts starting from the root.
-        # This means we won't accidentally traverse a symlink into some other
-        # filesystem (which is potentially expensive to access).
+        # We don't want to add "foo/bar/baz" to auditeddir before checking if
+        # there's a "foo/.hg" directory. This also means we won't accidentally
+        # traverse a symlink into some other filesystem (which is potentially
+        # expensive to access).
         for i in range(len(parts)):
             prefix = pycompat.ossep.join(parts[: i + 1])
             normprefix = pycompat.ossep.join(normparts[: i + 1])