Subject: Re: bug#11757: Acknowledgement (24.1.50; vc-git calls `process-file' too many times)

From: Dmitry Gutov <[email-masked]>
Date: Sun, 01 Jul 2012 03:38:15 +0400

On 01.07.2012 3:01, Stefan Monnier wrote:
>> 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.
>
> While that is suboptimal, VC's state is often suboptimal like that.
> The only cases where VC's state is (or at least really should)
> up-to-date is:
> - when it was changed by an explicit VC action.
> - when we need to know the state in order to make an important decision.
> Updating the state in other circumstances is good, but not necessary.
> Improving VC so that the first case is more frequent would actually
> be preferable.

AFAIK, the second case with `vc-git-registered' only occurs in 
`vc-next-action', where it can call `vc-register' if appropriate.

For that to happen, in `vc-deduce-fileset' either (vc-backend 
buffer-file-name) should return nil, or (vc-state ...) - 'unregistered.

So, in all variations on the theme "file unchanged, but not in git index 
anymore" this won't be true, neither with my original patch, nor with 
the currently installed code.

Invalidating property 'git-registered in `vc-deduce-fileset' might fix 
that, but having it know about Git backend is probably not good at all, 
and AFAIK most other backends just detect all states with a single 
process call, including 'unregistered (so they don't call their 
-registered function from -state function).

-- Dmitry