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

From: Dmitry Gutov <[email-masked]>
Date: Thu, 3 Sep 2015 21:40:54 +0300

On 09/03/2015 08:34 PM, Jonathan H wrote:

> I though the new implementation of the vc-git mode line doesn't use
> vc-working-revision,

Please look at the definition. vc-working-revision is called once in the 
beginning of the function, and again through vc-default-mode-line-string.

Even if we inlined the useful parts of vc-default-mode-line-string 
definition, calling vc-git-working-revision instead of 
vc-git--symbolic-ref is still inevitable in "detached" [Git] mode.

> True, but you have to check that the cache is invalid somehow. If you
> want to be super correct, a rev-parse is probably the fastest way. I

We err on the side of speed currently, instead of correctness. The file 
properties are invalidated during certain operations, like saving or 
reverting the buffer.

> suppose it would be pretty fast to check the mtime of the .git directory
> inside emacs and invalidate that when it changes. Although filesystem
> timestamps usually make me nervous, it's probably okay in this instance?

I don't know, but it's probably not too hard to imagine a user with a 
terminally slow HDD. Maybe it'll be fast enough anyway, but someone will 
have to do a patch, and test.