Subject: bug#21383: Static revisions in vc-working-revision

From: Dmitry Gutov <[email-masked]>
Date: Thu, 3 Sep 2015 15:56:34 +0300

On 09/03/2015 01:44 AM, Jonathan H wrote:

> I'm using (vc-working-revision buffer-file-name (vc-responsible-backend
> buffer-file-name)) to determine the current working revision.
>
> As far as I can tell, vc-working-revision will cache the current working
> revision in a file property, but it doesn't know when to invalidate the
> cache, so the results can be stale.

Yes, invalidation of those properties could use some improvement. But if 
you're just worried about up-to-date results returned to your functions, 
you could remove the property before calling `vc-working-revision'.

> In fact, in the specific case of
> git, you probably can't get any faster than a rev-parse anyway,

I wonder if that's true. Caching in a property is obviously fast, and 
process calls are necessarily an order of magnitude slower (and slower 
still on certain platforms).

Maybe you should write a patch and test it on Windows (or have someone 
else do it), and see whether the mode-line updates don't become 
perceptibly slower.

> I have a sneaking suspicion that git isn't the only backend where this
> can happen.

Probably. On the other hand, there are known backends where calling the 
backend program *is* slow. Such as Bazaar or (most likely) CVS.