]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle relative file names in vc-resynch-window and vc-resynch-buffer
authorJuri Linkov <juri@linkov.net>
Tue, 24 Jan 2023 18:48:20 +0000 (20:48 +0200)
committerJuri Linkov <juri@linkov.net>
Tue, 24 Jan 2023 18:48:20 +0000 (20:48 +0200)
* lisp/vc/vc-dispatcher.el (vc-resynch-window, vc-resynch-buffer):
While comparing with `buffer-file-name' if `file' is not absolute
use `expand-file-name' in `vc-root-dir'.  This fixes the case of
refreshing the buffers after typing `C-x v = C-x v u' (bug#60897).

lisp/vc/vc-dispatcher.el

index e1a3eff448d8abb28ea3c5dae0dc6a01cabcbe90..fd5f655a0f69fadc3d0e6a9c7b498c64a86680eb 100644 (file)
@@ -608,7 +608,10 @@ reverting.  NOQUERY should be t *only* if it is known the only
 difference between the buffer and the file is due to
 modifications by the dispatcher client code, rather than user
 editing!"
-  (and (string= buffer-file-name file)
+  (and (string= buffer-file-name
+                (if (file-name-absolute-p file)
+                    file
+                  (expand-file-name file (vc-root-dir))))
        (if keep
           (when (file-exists-p file)
             (when reset-vc-info
@@ -643,7 +646,10 @@ editing!"
 
 (defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
   "If FILE is currently visited, resynch its buffer."
-  (if (string= buffer-file-name file)
+  (if (string= buffer-file-name
+               (if (file-name-absolute-p file)
+                   file
+                 (expand-file-name file (vc-root-dir))))
       (vc-resynch-window file keep noquery reset-vc-info)
     (if (file-directory-p file)
        (vc-resynch-buffers-in-directory file keep noquery reset-vc-info)