vc-revert: Fix calling vc-buffer-sync (bug#79319)

* lisp/vc/vc.el (vc-revert): Don't call vc-buffer-sync on a
non-file-visiting buffer (bug#79319).  Don't try to use memq to
compare strings.
This commit is contained in:
Sean Whitton 2025-08-31 16:37:11 +01:00
parent 11dc1420e4
commit 0cd0aaa14f

View file

@ -3664,7 +3664,8 @@ to the working revision (except for keyword expansion)."
;; If any of the files is visited by the current buffer, make sure
;; buffer is saved. If the user says `no', abort since we cannot
;; show the changes and ask for confirmation to discard them.
(when (or (not files) (memq (buffer-file-name) files))
(when-let* ((n (buffer-file-name))
((or (not files) (member n files))))
(vc-buffer-sync nil))
(save-some-buffers nil (lambda ()
(and-let* ((n (buffer-file-name)))