From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#42966: 28.0.50; vc-dir: wrong backend Date: Sun, 18 Oct 2020 10:26:39 +0200 Message-ID: <87pn5gj5xc.fsf@gnus.org> References: <87d01imtwl.fsf@gnus.org> <3708c3db-df78-1a50-857a-595f2412e284@yandex.ru> <87v9fa44im.fsf@gnus.org> <1e9908c7-337d-9790-cd37-5232bc04233c@yandex.ru> <875z79z5mw.fsf@gnus.org> <871rhxz5e6.fsf@gnus.org> <3b9fda56-3f37-99ae-7f5e-1739a9c16020@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7878"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Sam Steingold , 42966@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 18 10:27:19 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kU429-0001uO-Tl for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 10:27:17 +0200 Original-Received: from localhost ([::1]:57904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kU428-00060p-Q6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 04:27:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kU41u-00060L-QR for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 04:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kU41u-0003T2-6u for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 04:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kU41u-0006Yh-4H for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 04:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Oct 2020 08:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42966 X-GNU-PR-Package: emacs Original-Received: via spool by 42966-submit@debbugs.gnu.org id=B42966.160300960925192 (code B ref 42966); Sun, 18 Oct 2020 08:27:02 +0000 Original-Received: (at 42966) by debbugs.gnu.org; 18 Oct 2020 08:26:49 +0000 Original-Received: from localhost ([127.0.0.1]:36149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kU41h-0006YG-L9 for submit@debbugs.gnu.org; Sun, 18 Oct 2020 04:26:49 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:48812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kU41g-0006Y3-Nd for 42966@debbugs.gnu.org; Sun, 18 Oct 2020 04:26:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=sNOMgX6ddPa3Ss9tgB8afphl2Hayg+WXpH4DCUvq/Zs=; b=i452oVcoaqjf8hcAAEGNhd3lrW LCzmRjcv1TQ9O4HE/lQV6z8odz1WOZ/68vRX4G+KiZeWbETJTY2dcgTHUWzFkWb4LkquDQm7pnzZ0 hQyZ7iXnMxD5SpmFZDvXxjpyN+YZg+j+dFkwW8RGVt1dCkryk/bHGHCWmIcuH9+Ysu/c=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kU41Y-0006QM-F1; Sun, 18 Oct 2020 10:26:43 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEVDNUhYT2KHdIYf GCT0zK+oXWX////KAn60AAAAAWJLR0QGYWa4fQAAAAd0SU1FB+QKEgciIGgyBOwAAAG7SURBVDjL XZRBcsMgDEWlquzBHvY2SfakTA/Qjr13Oub+V6mEwNAyWWT0pP9BCAMAoHV1TZQSB6z8Iv+BC9yS LECnoFVMISRdkg14FTgXbqmhCBYHsAzAdXMX1g6InTq4UwMp4VhxXzqA0eP+TQ1E7CCE+zZ386sk CLhdQCuwgu/5OmIBVk4Z2GNu5qjnsKI3jQcEBQQqlkYgyaCdWUZQmkjFy7awycXcWqBS0uJ+24oU WydJqDuKHFeA5V7AaTfAnwr6BZd05/N2ASpAlPBV8qsUJQHISv5lNN5AqWPXPNd4ATMUQNHl/Lnl LkUVPH0+TB6kSDdFbz4TXlLcQQUoIJpt8KCyW5yRwXsHFitIi8/QAceoaGGyJhszANSOTOTM8e4H DwbiFGg1x3mMB+Qbj8iPZkV77gOQKREaA1q//QM8IPNHsHB5XyC4eXossfV2yxVMqyOew96RrHfq pgViCKuFP8AKwGd4vJz1/yr4UcXw+Fmduu/b0QDPFLKWU5PcgeMR4We+Kjh3HajyDig9xV7BVywf DlAgYk7c9/OQgUYlc5m2qQJTkgWgTnpEnsM9v7wagzyoOtEK8i+W2o66dNtRxAAAACV0RVh0ZGF0 ZTpjcmVhdGUAMjAyMC0xMC0xOFQwNzozNDozMiswMDowMGkk31EAAAAldEVYdGRhdGU6bW9kaWZ5 ADIwMjAtMTAtMThUMDc6MzQ6MzIrMDA6MDAYeWftAAAAAElFTkSuQmCC X-Now-Playing: Rocket To The Sky's _Cigars_: "Cigars" In-Reply-To: <3b9fda56-3f37-99ae-7f5e-1739a9c16020@yandex.ru> (Dmitry Gutov's message of "Sat, 17 Oct 2020 23:41:24 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:190871 Archived-At: --=-=-= Content-Type: text/plain Dmitry Gutov writes: > Could you send an attachment? Included here. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-root.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)))) --=-=-=--