From f8cb751ac0a403bc3769cac9816ad46809b7740e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Aug 2025 19:40:11 +0100 Subject: [PATCH] vc-hg-known-other-working-trees: Fix on MS-Windows * lisp/vc/vc-hg.el (vc-hg-known-other-working-trees): Use expand-file-name to convert paths from .hg/sharedpath files. --- lisp/vc/vc-hg.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index e9095b72098..b0e5a633566 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -1738,7 +1738,10 @@ Intended for use via the `vc-hg--async-command' wrapper." (if (file-exists-p our-sp) (with-temp-buffer (insert-file-contents-literally our-sp) - (setq our-store (string-trim (buffer-string))) + ;; On MS-Windows, ".hg/sharedpath" gives file names with + ;; backslashes; expand-file-name normalizes that to forward + ;; slashes, needed for 'equal' comparison below. + (setq our-store (expand-file-name (string-trim (buffer-string)))) (push (abbreviate-file-name (file-name-directory our-store)) shares)) (setq our-store (expand-file-name ".hg" our-root))) @@ -1748,7 +1751,9 @@ Intended for use via the `vc-hg--async-command' wrapper." ((file-exists-p sp))) (with-temp-buffer (insert-file-contents-literally sp) - (when (equal our-store (buffer-string)) + (when (equal our-store + ;; See above why we use expand-file-name + (expand-file-name (string-trim (buffer-string)))) (push root shares))))) shares))