diff --git a/lisp/files.el b/lisp/files.el index 740e09055bb..b084dca8b7d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5196,7 +5196,9 @@ to `default-directory', and the result will also be relative." (cond ;; filename is at top-level, therefore no parent ((or (null parent) - (file-equal-p parent expanded-filename)) + ;; `equal' is enough, we don't need to resolve symlinks here + ;; with `file-equal-p', also for performance + (equal parent expanded-filename)) nil) ;; filename is relative, return relative parent ((not (file-name-absolute-p filename))