Subject: Re: bug#60897: 29.0.60; vc-revert fails to revert buffer

From: Juri Linkov <[email-masked]>
Date: Sun, 22 Jan 2023 19:17:21 +0200

> But as you noticed it doesn't refresh the buffer.  This is because
> vc-deduce-fileset in the diff buffer now returns relative file names,
> not absolute as vc-resynch-buffer expects.
>
> Expanding relative file names to absolute is not possible in
> diff-vc-deduce-fileset, because then C-x v v will fail in
> vc-default-checkin-patch that expects relative file names.
>
> So I think the right place to do this is before trying to compare
> relative names with (string= buffer-file-name file):
>
> diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
> @@ -643,6 +643,8 @@ vc-resynch-buffers-in-directory
>  
>  (defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
>    "If FILE is currently visited, resynch its buffer."
> +  (unless (file-name-absolute-p file)
> +    (setq file (expand-file-name file (vc-root-dir))))
>    (if (string= buffer-file-name file)
>        (vc-resynch-window file keep noquery reset-vc-info)
>      (if (file-directory-p file)

Eli, is this ok for the emacs-29 branch?  I'm unsure because
vc-resynch-buffer is used in too many places, so this change
is not localized to vc-revert.