Subject: Re: bug#20637: incompatible, undocumented change to vc-working-revision

From: Dmitry Gutov <[email-masked]>
Date: Tue, 29 Mar 2016 02:28:22 +0300

On 05/24/2015 02:49 AM, Glenn Morris wrote:

> Current master:
>   (vc-working-revision "1")  ;  "master"

This has been caused by the commit 
7f9b037245ddb662ad98685e429a2498ae6b7c62, which made both vc-state and 
vc-working-revision use vc-responsible-backend instead of vc-backend.

As a result, in some backends these functions started return non-nil 
values for unknown files or directories, as long as they lie inside a VC 
repository.

This change is indeed backward-incompatible, and it breaks the previous 
assumption of some backend functions that if FILE has been passed to it, 
then it's surely registered with the current backend. That's why the 
commit included changes adding lines like (unless (memq (vc-state file) 
'(nil unregistered))...), but it didn't get all affected code.

In particular, it breaks an assumption I made when fixing #11757, that 
vc-git-state never receives an unregistered file as input. So if you 
evaluate (vc-state "1") now, it'll return `up-to-date'.

While reverting the change makes some tests fail, we should fix them in 
different ways.

For some backends, maybe, we should accept that (vc-state 
default-directory) and (vc-working-revision default-directory) will 
return nil. Alternatively, fix that problem inside the respective 
backends, without changing the dispatching functions.

Also, reverting this commit also seems to uncover tests that shouldn't 
pass anyway. Checks like

   (should (eq (vc-state default-directory)
               (vc-state default-directory backend)))

don't verify much, and in this case they seem to verify the wrong thing. 
More on that in the respective threads in emacs-devel later.

Michael, thoughts?