[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60897: 29.0.60; vc-revert fails to revert buffer
From: |
Eli Zaretskii |
Subject: |
bug#60897: 29.0.60; vc-revert fails to revert buffer |
Date: |
Tue, 24 Jan 2023 20:06:17 +0200 |
> From: Juri Linkov <juri@linkov.net>
> Cc: epg@pretzelnet.org, 60897@debbugs.gnu.org
> Date: Tue, 24 Jan 2023 19:46:51 +0200
>
> > 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)
I'm confused: I though the problem was that FILE was some relative
form of buffer-file-name, which is why you wanted to run it through
expand-file-name, to make it absolute. But if this is the case,
i.e. you have file = "foo" and buffer-file-name = /path/to/foo, then
string-prefix-p will not do the job, right? And even if it did, you
could have false positives.
Maybe I just don't understand what this if clause is trying to test?
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Eric Gillespie, 2023/01/17
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Juri Linkov, 2023/01/18
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Eric Gillespie, 2023/01/20
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Juri Linkov, 2023/01/22
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Eli Zaretskii, 2023/01/22
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Juri Linkov, 2023/01/23
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Eli Zaretskii, 2023/01/23
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Juri Linkov, 2023/01/24
- bug#60897: 29.0.60; vc-revert fails to revert buffer,
Eli Zaretskii <=
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Juri Linkov, 2023/01/24
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Eli Zaretskii, 2023/01/24
- bug#60897: 29.0.60; vc-revert fails to revert buffer, Juri Linkov, 2023/01/24