bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50572: 28.0.50; [PATCH] fix VC to find the responsible backend with


From: Eli Zaretskii
Subject: bug#50572: 28.0.50; [PATCH] fix VC to find the responsible backend with the most specific path.
Date: Fri, 12 Nov 2021 14:05:17 +0200

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Date: Fri, 12 Nov 2021 10:51:36 +0100
> Cc: 50572@debbugs.gnu.org, Andy Moreton <andrewjmoreton@gmail.com>,
>  Dmitry Gutov <dgutov@yandex.ru>
> 
> > It's pushed to the trunk now -- can you adjust the patch to use that
> > instead?
> 
> There you go.
> 
> >From 2e4e651b722673439be2654c7aae4202e8e73cd4 Mon Sep 17 00:00:00 2001
> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Date: Fri, 12 Nov 2021 10:46:56 +0100
> Subject: [PATCH] Find most specific backend for `vc-backend-for-registration'.
> 
> ---
>  lisp/vc/vc.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index 4b56f1b795..b8f0425393 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -945,7 +945,7 @@ vc-backend-for-registration
>        (dolist (backend vc-handled-backends)
>          (when (not (vc-call-backend backend 'registered file))
>            (let* ((path (vc-call-backend backend 'responsible-p file))
> -                 (len (length path)))
> +                 (len (and path (length (file-name-split path)))))
>              (when (and len (> len max))
>                (setq max len bk backend)))))
>        (when bk

Please don't use "path" for anything that is not PATH-style directory
lists.

Also, shouldn't the file name(s) be run through expand-file-name, to
make sure they are absolute?  Otherwise comparing the length will not
DTRT.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]