Subject: bug#42966: 28.0.50; vc-dir: wrong backend

From: Dmitry Gutov <[email-masked]>
Date: Fri, 16 Oct 2020 15:44:34 +0300

On 16.10.2020 11:55, Lars Ingebrigtsen wrote:

> But:
> 
>        (catch 'found
> 	;; First try: find a responsible backend.  If this is for registration,
> 	;; it must be a backend under which FILE is not yet registered.
> 	(dolist (backend vc-handled-backends)
> 	  (and (vc-call-backend backend 'responsible-p file)
> 	       (throw 'found backend))))
> 
> This just goes through the backends and the first one that happens to be
> able to say "yes" wins.  Shouldn't this instead go through all the
> backends, and if more than one says "yes", then choose the one with the
> most specific path?
> 
> Looking at the code, that shouldn't be too hard to implement, because it
> seems like responsible-p returns the root path?

The code should be straightforward, but I'd like to see some performance 
measurements: both for the local case, and for the remote one (Tramp).

The difference can be small, though, given that we already try a number 
of other backends first (Git is near the end of vc-handled-backends; we 
might want to change that, BTW).