From: Lars Ingebrigtsen <larsi@gnus.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Sam Steingold <sds@gnu.org>, 42966@debbugs.gnu.org
Subject: bug#42966: 28.0.50; vc-dir: wrong backend
Date: Sat, 17 Oct 2020 09:19:13 +0200 [thread overview]
Message-ID: <871rhxz5e6.fsf@gnus.org> (raw)
In-Reply-To: <875z79z5mw.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 17 Oct 2020 09:13:59 +0200")
Lars Ingebrigtsen <larsi@gnus.org> writes:
> And here's the benching with the patch applied:
Fixed patch:
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 39d0fab391..8def7da377 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -979,12 +979,22 @@ vc-responsible-backend
If NO-ERROR is nil, signal an error that no VC backend is
responsible for the given file."
(or (and (not (file-directory-p file)) (vc-backend file))
- (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))))
+ ;; First try: find a responsible backend. If this is for registration,
+ ;; it must be a backend under which FILE is not yet registered.
+ (let ((dirs (delq nil
+ (mapcar
+ (lambda (backend)
+ (when-let ((dir (vc-call-backend
+ backend 'responsible-p file)))
+ (cons backend dir)))
+ vc-handled-backends))))
+ ;; Just a single response (or none); use it.
+ (if (< (length dirs) 2)
+ (caar dirs)
+ ;; Several roots; we seem to have one vc inside another's
+ ;; directory. Choose the most specific.
+ (caar (sort dirs (lambda (d1 d2)
+ (< (length (cdr d2)) (length (cdr d1))))))))
(unless no-error
(error "No VC backend is responsible for %s" file))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-10-17 7:19 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 15:15 bug#42966: 28.0.50; vc-dir: wrong backend Sam Steingold
2020-10-16 8:55 ` Lars Ingebrigtsen
2020-10-16 12:44 ` Dmitry Gutov
2020-10-16 14:41 ` Lars Ingebrigtsen
2020-10-16 14:44 ` Dmitry Gutov
2020-10-17 7:02 ` Lars Ingebrigtsen
2020-10-17 7:13 ` Lars Ingebrigtsen
2020-10-17 7:19 ` Lars Ingebrigtsen [this message]
2020-10-17 20:41 ` Dmitry Gutov
2020-10-18 8:26 ` Lars Ingebrigtsen
2020-10-17 20:44 ` Dmitry Gutov
2020-10-18 7:38 ` Michael Albinus
2020-10-23 23:53 ` Dmitry Gutov
2020-10-24 13:41 ` Michael Albinus
2020-10-24 19:42 ` Dmitry Gutov
2020-10-25 17:49 ` Michael Albinus
2020-10-26 14:29 ` Dmitry Gutov
2020-10-26 15:17 ` Michael Albinus
2020-10-26 20:12 ` bug#42966: (no subject) Lars Ingebrigtsen
2020-10-26 20:13 ` Lars Ingebrigtsen
2020-10-26 20:55 ` bug#42966: Dmitry Gutov
2020-10-26 21:02 ` bug#42966: Lars Ingebrigtsen
2020-10-26 21:44 ` bug#42966: Dmitry Gutov
2020-10-26 21:11 ` bug#42966: 28.0.50; vc-dir: wrong backend Dmitry Gutov
2020-10-18 8:32 ` Lars Ingebrigtsen
2020-10-16 15:35 ` Glenn Morris
2020-10-16 18:19 ` Dmitry Gutov
2020-10-17 6:06 ` Lars Ingebrigtsen
2020-10-17 20:01 ` Dmitry Gutov
2020-10-18 8:31 ` Lars Ingebrigtsen
2020-10-26 21:54 ` Glenn Morris
2020-10-26 21:58 ` Lars Ingebrigtsen
2020-10-26 22:14 ` Dmitry Gutov
2020-10-26 22:11 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rhxz5e6.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=42966@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=sds@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.