unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eric Gillespie <epg@pretzelnet.org>
Cc: 60897@debbugs.gnu.org
Subject: bug#60897: 29.0.60; vc-revert fails to revert buffer
Date: Wed, 18 Jan 2023 19:29:16 +0200	[thread overview]
Message-ID: <86edrr4zcz.fsf@mail.linkov.net> (raw)
In-Reply-To: <29401.1674004194@hassadar.pretzelnet.org> (Eric Gillespie's message of "Tue, 17 Jan 2023 19:09:54 -0600")

> 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)
```





  reply	other threads:[~2023-01-18 17:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  1:09 bug#60897: 29.0.60; vc-revert fails to revert buffer Eric Gillespie
2023-01-18 17:29 ` Juri Linkov [this message]
2023-01-21  0:54   ` Eric Gillespie
2023-01-22 17:12     ` Juri Linkov
2023-01-22 17:17   ` Juri Linkov
2023-01-22 19:50     ` Eli Zaretskii
2023-01-23  7:51       ` Juri Linkov
2023-01-23 13:24         ` Eli Zaretskii
2023-01-24 17:46           ` Juri Linkov
2023-01-24 18:06             ` Eli Zaretskii
2023-01-24 18:18               ` Juri Linkov
2023-01-24 18:36                 ` Eli Zaretskii
2023-01-24 18:49                   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86edrr4zcz.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=60897@debbugs.gnu.org \
    --cc=epg@pretzelnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).