GNU bug report logs -
#60897
29.0.60; vc-revert fails to revert buffer
Previous Next
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
View this message in rfc822 format
>> >> > (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)
>>
>> There is another string= call that fails inside vc-resynch-window
>> called from vc-resynch-buffer.
>
> How about replacing string= in these two cases with something smarter,
> which would expand-file-name? Comparing file names as simple strings
> is wrought with trouble anyway.
This works as well:
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index e1a3eff448d..8a0cdef4726 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -608,7 +608,7 @@ vc-resynch-window
difference between the buffer and the file is due to
modifications by the dispatcher client code, rather than user
editing!"
- (and (string= buffer-file-name file)
+ (and (string-prefix-p file buffer-file-name)
(if keep
(when (file-exists-p file)
(when reset-vc-info
@@ -643,7 +643,7 @@ vc-resynch-buffers-in-directory
(defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
"If FILE is currently visited, resynch its buffer."
- (if (string= buffer-file-name file)
+ (if (string-prefix-p file buffer-file-name)
(vc-resynch-window file keep noquery reset-vc-info)
(if (file-directory-p file)
(vc-resynch-buffers-in-directory file keep noquery reset-vc-info)
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.