GNU bug report logs - #60897
29.0.60; vc-revert fails to revert buffer

Previous Next

Package: emacs;

Reported by: Eric Gillespie <epg <at> pretzelnet.org>

Date: Wed, 18 Jan 2023 01:11:01 UTC

Severity: normal

Fixed in version 29.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 60897 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eric Gillespie <epg <at> pretzelnet.org>
Cc: 60897 <at> debbugs.gnu.org
Subject: Re: bug#60897: 29.0.60; vc-revert fails to revert buffer
Date: Wed, 18 Jan 2023 19:29:16 +0200
> 2. emacs -Q emacs/BUGS
> 3. Make any change at all.  Save it.
> 4. C-x v =
> 5. C-x v u
>
> Step 4 switches to the diff buffer, as it always has (good).
>
> If you switch back to the file buffer and C-x v u there, the file
> is reverted and with it the buffer.
>
> But we're staying in the diff buffer:
>
> Expected behavior:
> File and buffer both reverted.
>
> Actual behavior:
> File is reverted but buffer is NOT.

The behavior of C-x v u in the diff buffer was improved in emacs-29
to revert all files mentioned in the diff.  In emacs-28 it reverted
only one file, but in emacs-29 when the diff buffer shows many files,
such as after C-x v D, all these files are reverted.

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
index e1a3eff448d..3f9c39f2aff 100644
--- 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)
```




This bug report was last modified 2 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.