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

From: Michael Albinus <[email-masked]>
Date: Sun, 01 Jul 2012 11:58:28 +0200

Dmitry Gutov <[email-masked]> writes:

>>> I'm not sure what we should do. Call (vc-mode-line) anyway? That would work.
>>
>> Nope. This is expansive, because it recomputes `vc-working-revision'. We
>> would loose all improvements from using the cache.
>
> I don't think so.
>
> If we hadn't reset all properties in vc-before-save (file existed),
> nothing changes.
> If we did reset them, then yes, vc-working-revision will recompute
> vc-working-revision property, but only once after the reset.
> Which is what we want to do anyway, since the file's state has
> changed, and the working revision could have changed as well, so we
> need to know them to update mode-line.

Likely, the best option is to call (vc-registered file) after clearing
the file cache. This recomputes the 'vc-backend property as well, what
we want.

Calling (vc-mode-line file) at this point would be for the side-effect
of that function, which is bad in my experience. It would harden
maintenance, 'cause nobody will know why we want to refresh the modeline
at this point.

> By the way, this last patch I sent doesn't help if the user just
> removed the file from repository while leaving it on disk (git rm
> --cached ... && git commit ..., for example), but whatever.

If we use the cache, there will always be a constellation that the cache
is stale due to external operations. As Stefan said, this is mostly
uncritical.

Best regards, Michael.