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

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

bug#23436: [PATCH] Use the true name of a file to determine responsible


From: Hong Xu
Subject: bug#23436: [PATCH] Use the true name of a file to determine responsible vc.
Date: Wed, 19 Oct 2016 12:19:51 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0

A better version of the fix is attached.


On 05/03/2016 02:32 PM, Hong Xu wrote:
> In many cases, e.g., a symbolic link to a directory inside a vc tracked
> directory, vc-responsible-backend would fail to know the true backend.
> 
> ---
> 
> There is probably a better fix than this... Feel free to do so.
> 
> ---
>  lisp/vc/vc.el | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index 25b41e34e645..1b060b4d1374 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -960,14 +960,15 @@ If FILE is already registered, return the
>  backend of FILE.  If FILE is not registered, then the
>  first backend in `vc-handled-backends' that declares itself
>  responsible for FILE is returned."
> -  (or (and (not (file-directory-p file)) (vc-backend file))
> +  (let ((file-path (file-truename file)))
> +    (or (and (not (file-directory-p file-path)) (vc-backend file-path))
>        (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))))
> -      (error "No VC backend is responsible for %s" file)))
> +        ;; 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-path)
> +            (throw 'found backend))))
> +      (error "No VC backend is responsible for %s" file-path))))
>  
>  (defun vc-expand-dirs (file-or-dir-list backend)
>    "Expands directories in a file list specification.
> 

Attachment: vc.patch
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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