Handle relative file names in vc-resynch-window and vc-resynch-buffer

* 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).
This commit is contained in:
Juri Linkov 2023-01-24 20:48:20 +02:00
parent 695e9f71c3
commit ecf500b5e3

View 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 difference between the buffer and the file is due to
modifications by the dispatcher client code, rather than user modifications by the dispatcher client code, rather than user
editing!" 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 (if keep
(when (file-exists-p file) (when (file-exists-p file)
(when reset-vc-info (when reset-vc-info
@ -643,7 +646,10 @@ editing!"
(defun vc-resynch-buffer (file &optional keep noquery reset-vc-info) (defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
"If FILE is currently visited, resynch its buffer." "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) (vc-resynch-window file keep noquery reset-vc-info)
(if (file-directory-p file) (if (file-directory-p file)
(vc-resynch-buffers-in-directory file keep noquery reset-vc-info) (vc-resynch-buffers-in-directory file keep noquery reset-vc-info)