all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23436: [PATCH] Use the true name of a file to determine responsible vc.
@ 2016-05-03 21:32 Hong Xu
  2016-10-19 19:19 ` Hong Xu
  0 siblings, 1 reply; 31+ messages in thread
From: Hong Xu @ 2016-05-03 21:32 UTC (permalink / raw)
  To: 23436; +Cc: Hong Xu

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







^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2016-11-04 10:08 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03 21:32 bug#23436: [PATCH] Use the true name of a file to determine responsible vc Hong Xu
2016-10-19 19:19 ` Hong Xu
2016-10-19 19:33   ` bug#23436: [PATCH] Attemp to use the true name of a file to determine responsible vc if the genuine name does not work Hong Xu
2016-10-19 23:37     ` Dmitry Gutov
2016-10-19 23:49       ` Hong Xu
2016-10-19 23:58         ` Dmitry Gutov
2016-10-20  0:16           ` Hong Xu
2016-10-20  6:58             ` Eli Zaretskii
2016-10-20  7:21               ` Hong Xu
2016-10-20  8:23                 ` Eli Zaretskii
2016-10-20  8:50                   ` Dmitry Gutov
2016-10-20  9:46                   ` Andreas Schwab
2016-10-20 10:02                     ` Eli Zaretskii
2016-10-20 10:58                       ` Eli Zaretskii
2016-10-20  9:47             ` Dmitry Gutov
2016-10-20 16:39               ` Hong Xu
2016-10-20 22:34                 ` Dmitry Gutov
2016-10-20 23:04                   ` Hong Xu
2016-10-24 23:41                     ` Dmitry Gutov
2016-10-25 19:05                       ` Hong Xu
2016-10-25 23:12                         ` Dmitry Gutov
2016-10-30  0:42                           ` Hong Xu
2016-10-30 16:21                             ` Eli Zaretskii
2016-10-30 22:50                               ` Hong Xu
2016-10-31 15:43                                 ` Eli Zaretskii
2016-10-31 19:38                                   ` Hong Xu
2016-11-01 18:47                                     ` Eli Zaretskii
2016-11-04  7:46                                       ` Hong Xu
2016-11-04 10:08                                         ` Eli Zaretskii
2016-10-31 11:34                             ` Dmitry Gutov
2016-10-31 19:24                               ` Hong Xu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.