GNU bug report logs -
#11757
24.1.50; vc-git calls `process-file' too many times
Previous Next
Reported by: Dmitry Gutov <dgutov <at> yandex.ru>
Date: Thu, 21 Jun 2012 02:17:02 UTC
Severity: normal
Found in version 24.1.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 30.06.2012 13:03, Michael Albinus wrote:
> Dmitry Gutov <dgutov <at> yandex.ru> writes:
>
>> On 29.06.2012 20:40, Michael Albinus wrote:
>>>>> A stale cache is bad, of course. We must carefully check, where a cached
>>>>> value has to be invalidated. But why should vc-working-revision being
>>>>> invalidated after saving? It is still the same, I believe. Switching to
>>>>> another branch shall be observed by Emacs, 'cause there is another
>>>>> version of the file on the disk, and Emacs warns you before editing.
>>>>
>>>> This won't happen in following cases:
>>>> 1) We switch to revision when the opened file is the same.
>>>> 2) It doesn't exist there.
>>>> 3) We just delete it from disk from outside of Emacs.
>>>> So the file isn't changed, and you see no warning or update, even
>>>> after you write it to disk from Emacs again.
>>>
>>> I see. Maybe we find a hook, where we could invalidate the vc cache when
>>> a file is written which does not exist on the disk?
>>
>> (vc-before-save) might be the place to do that.
>
> In vc-after-save, vc-git-state is called. Wouldn't it be sufficient to
> invalidate the cache there, when it detects that the file is not up-to-date?
Why there? Problem with working-revision is common for all backends, as
far as I can see.
Also, how? After the file is written, we can't check if it didn't exist
on disk anymore.
Here's what I had in mind:
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index bba7217..4bff5fc 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -703,7 +703,9 @@ Before doing that, check if there are any old
backups and get rid of them."
;; another name. This enables local diffs and local reverting.
(let ((file buffer-file-name)
backend)
- (ignore-errors ;Be careful not to prevent saving the
file.
+ (ignore-errors ;Be careful not to prevent saving the file.
+ (unless (file-exists-p file)
+ (vc-file-clearprops file))
(and (setq backend (vc-backend file))
(vc-up-to-date-p file)
(eq (vc-checkout-model backend (list file)) 'implicit)
This bug report was last modified 12 years and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.