emacs-31 5b5cc17832c: vc-working-revision: Don't bind default-directory to a relative name

Sean Whitton <[email protected]> Wed, 29 Jul 2026 06:05:29 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 5b5cc17832ce3f5fb1405e32a7aec5145f552e57
Author: Sean Whitton <[email protected]>
Commit: Sean Whitton <[email protected]>

    vc-working-revision: Don't bind default-directory to a relative name
    
    * lisp/vc/vc-hooks.el (vc-working-revision): Don't bind
    default-directory to a relative file name.
---
 lisp/vc/vc-hooks.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 64ad4d5daec..132b9211f88 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -587,12 +587,13 @@ If FILE is not registered, this function always returns nil.
 This function does not return nil without first confirming with the
 underlying VCS that FILE is unregistered; this is in contrast to
 `vc-symbolic-working-revision'."
-  (or (vc-file-getprop file 'vc-working-revision)
-      (let ((default-directory (file-name-directory file)))
-        (and (setq backend (or backend (vc-backend file)))
-             (vc-file-setprop file 'vc-working-revision
-                              (vc-call-backend backend 'working-revision
-                                               file))))))
+  (let ((abs (expand-file-name file)))
+    (or (vc-file-getprop abs 'vc-working-revision)
+        (let ((default-directory (file-name-directory abs)))
+          (and (setq backend (or backend (vc-backend file)))
+               (vc-file-setprop abs 'vc-working-revision
+                                (vc-call-backend backend 'working-revision
+                                                 file)))))))
 
 (defun vc-symbolic-working-revision (file &optional backend)
   "Return BACKEND's symbolic name for FILE's working revision.