From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Hong Xu Newsgroups: gmane.emacs.bugs Subject: bug#23436: [PATCH] Use the true name of a file to determine responsible vc. Date: Wed, 19 Oct 2016 12:19:51 -0700 Message-ID: <85f11f8a-1799-befd-3e5b-f7d7a6eac660@topbug.net> References: <1462311145-5959-1-git-send-email-hong@topbug.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ptwnC7sawV0a6xdhNaP9hXpwQ7iVTXVDu" X-Trace: blaine.gmane.org 1476904889 11619 195.159.176.226 (19 Oct 2016 19:21:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Oct 2016 19:21:29 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 To: 23436@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 19 21:21:25 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwQK-0000ym-7n for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Oct 2016 21:21:12 +0200 Original-Received: from localhost ([::1]:50550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwwQM-0007Sp-FJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Oct 2016 15:21:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwwQD-0007Qk-JI for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwwQA-0000ea-EX for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33860) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwwQA-0000eP-Bc for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bwwQA-00077D-7V for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Oct 2016 19:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23436 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.147690481427267 (code B ref -1); Wed, 19 Oct 2016 19:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Oct 2016 19:20:14 +0000 Original-Received: from localhost ([127.0.0.1]:40050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwPO-00075i-3x for submit@debbugs.gnu.org; Wed, 19 Oct 2016 15:20:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwPM-00075N-2r for submit@debbugs.gnu.org; Wed, 19 Oct 2016 15:20:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwwPF-0008WL-QT for submit@debbugs.gnu.org; Wed, 19 Oct 2016 15:20:06 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwwPF-0008Vz-Nh for submit@debbugs.gnu.org; Wed, 19 Oct 2016 15:20:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwwPD-0006oY-FZ for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:20:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwwPA-0008Tn-9w for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:20:03 -0400 Original-Received: from sender163-mail.zoho.com ([74.201.84.163]:21386) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwwP9-0008TQ-W2 for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:20:00 -0400 Original-Received: from [192.168.88.2] (cpe-104-32-170-214.socal.res.rr.com [104.32.170.214]) by mx.zohomail.com with SMTPS id 1476904795949216.28129094457574; Wed, 19 Oct 2016 12:19:55 -0700 (PDT) In-Reply-To: <1462311145-5959-1-git-send-email-hong@topbug.net> X-Zoho-Virus-Status: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124689 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ptwnC7sawV0a6xdhNaP9hXpwQ7iVTXVDu Content-Type: multipart/mixed; boundary="q6E9Ch7Sn3qLoemEmwSnvwoLrlV90e88a"; protected-headers="v1" From: Hong Xu To: bug-gnu-emacs@gnu.org Message-ID: <85f11f8a-1799-befd-3e5b-f7d7a6eac660@topbug.net> Subject: Re: [PATCH] Use the true name of a file to determine responsible vc. References: <1462311145-5959-1-git-send-email-hong@topbug.net> In-Reply-To: <1462311145-5959-1-git-send-email-hong@topbug.net> --q6E9Ch7Sn3qLoemEmwSnvwoLrlV90e88a Content-Type: multipart/mixed; boundary="------------08A9F019FE8B13849704840A" This is a multi-part message in MIME format. --------------08A9F019FE8B13849704840A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > --- >=20 > There is probably a better fix than this... Feel free to do so. >=20 > --- > lisp/vc/vc.el | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) >=20 > 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 registratio= n, > - ;; 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 regi= stration, > + ;; it must be a backend under which FILE is not yet registered= =2E > + (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)))) > =20 > (defun vc-expand-dirs (file-or-dir-list backend) > "Expands directories in a file list specification. >=20 --------------08A9F019FE8B13849704840A Content-Type: text/x-patch; name="vc.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vc.patch" diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index af875e89907f..368c89fb2557 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -964,9 +964,10 @@ vc-responsible-backend (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)))) + (dolist (file-path (list file (file-truename file))) + (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))) =20 (defun vc-expand-dirs (file-or-dir-list backend) --------------08A9F019FE8B13849704840A-- --q6E9Ch7Sn3qLoemEmwSnvwoLrlV90e88a-- --ptwnC7sawV0a6xdhNaP9hXpwQ7iVTXVDu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYB8dbAAoJECZsfTOCL4R4XdgQANd0yAT/Q5tyPm4q4mee8X9D v27odV2+b/F03Sqhc8glOS+gqjAVkGhcw12sBmXg3F/GasKdT8DUWwceXWEiD1W8 XSbfZ0cgt1Xt604I2UNVO4aCdoKjtDk7tllIahyNYT3ZZvph6/tJpBGUE8VU3saS 99ntZSx/04V8xmkqY2ufri+pC6DRPhOAFnZrdxPWA+CrFyqw3DOgkjvd3mPtPyDn gQMCEp6DH7n2h4ErEapgnIK9kXFbBFDXVDH+zY4iHSIqbVhIP5ewvQ2X5oPknE7E Rxk1ju+c3vr7c4HLjjQ/+gJxh8C40tcMnGnZJCPAzzQSFmZmh25EpeMAZ8CSSheV D06hLErQTrUBUEW4K6KtmZZeeIUC/GUm2uR3GW93UXwKZ00BeVCdgD8rS+5yc1gk ejHuatfTyuqYqudAx7EJrgTsb6JuRGCkiayn0VFujMGwP55A6IBdEfLXz7a1jeQ4 q2wfqA2WhDUoRzOJvxCYP/7/cQF+yNib+vZ97lFJRJxAEOim4BmAf18Jbt8iVaNg 0CbPMSmyVLpE1kk2bsv19oawW8bprUbu+d7as7XBbJ5F2mGR5que9E2MNpzkx19W K7n12I+/U5cvuPwUI04V5W1UOYJnG8izDL3/X9rIpPBAjeFRw/XnIYzQQXFQ55Tv pbbasdoM6MdRcMPz+jMV =g1Nz -----END PGP SIGNATURE----- --ptwnC7sawV0a6xdhNaP9hXpwQ7iVTXVDu--