GNU bug report logs - #23436
[PATCH] Use the true name of a file to determine responsible vc.

Previous Next

Package: emacs;

Reported by: Hong Xu <hong <at> topbug.net>

Date: Tue, 3 May 2016 21:34:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#23436: closed ([PATCH] Use the true name of a file to
 determine responsible vc.)
Date: Fri, 04 Nov 2016 10:09:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 04 Nov 2016 12:08:59 +0200
with message-id <834m3nlfpg.fsf <at> gnu.org>
and subject line Re: bug#23436: [PATCH] Attemp to use the true name of a file to determine responsible vc if the genuine name does not work.
has caused the debbugs.gnu.org bug report #23436,
regarding [PATCH] Use the true name of a file to determine responsible vc.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
23436: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23436
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Hong Xu <hong <at> topbug.net>
To: bug-gnu-emacs <at> gnu.org
Cc: Hong Xu <hong <at> topbug.net>
Subject: [PATCH] Use the true name of a file to determine responsible vc.
Date: Tue,  3 May 2016 14:32:25 -0700
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.
-- 
2.8.2




[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Hong Xu <hong <at> topbug.net>
Cc: 23436-done <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: bug#23436: [PATCH] Attemp to use the true name of a file to
 determine responsible vc if the genuine name does not work.
Date: Fri, 04 Nov 2016 12:08:59 +0200
> From: Hong Xu <hong <at> topbug.net>
> Cc: dgutov <at> yandex.ru, 23436 <at> debbugs.gnu.org
> Date: Fri, 04 Nov 2016 00:46:05 -0700
> 
> On 2016-11-01 Tue 11:47 GMT-0700, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> >> From: Hong Xu <hong <at> topbug.net>
> >> Cc: dgutov <at> yandex.ru, 23436 <at> debbugs.gnu.org
> >> Date: Mon, 31 Oct 2016 12:38:42 -0700
> >> 
> >> On 2016-10-31 Mon 08:43 GMT-0700, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >> >
> >> > The node "Truenames" sounds like a good place.
> >> 
> >> Added in the new patch now (along with the change of the previous version).
> >
> > LGTM, thanks.
> 
> Can we apply the patch if it is good enough? Thanks.

Pushed now.

Please note that I generally wait for a week or so since the last
comment before pushing changes, to let people enough time to comment
or object.


This bug report was last modified 8 years and 204 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.