From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Scherer Newsgroups: gmane.emacs.bugs Subject: bug#37217: Acknowledgement ([PATCH] vc-default-ignore implementation is incorrect) Date: Thu, 29 Aug 2019 17:44:23 +0200 Message-ID: <96e5b707-0150-4deb-96eb-20e8cad14266@gmx.de> References: <4b41d328-04ef-8fc3-9b89-6362e83c37a6@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C10DB4A3B55AFBC7D5359829" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="140537"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 To: 37217@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 29 17:46:03 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i3Mcb-000aLf-OP for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Aug 2019 17:46:01 +0200 Original-Received: from localhost ([::1]:51276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3Mca-0004ci-Ay for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Aug 2019 11:46:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59241) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3Mbg-0004bf-Dq for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2019 11:45:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i3Mbf-0003Mn-1M for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2019 11:45:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i3Mbe-0003LM-Bq for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2019 11:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i3Mbe-00029f-6t for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2019 11:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Wolfgang Scherer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Aug 2019 15:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37217 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 37217-submit@debbugs.gnu.org id=B37217.15670934758207 (code B ref 37217); Thu, 29 Aug 2019 15:45:02 +0000 Original-Received: (at 37217) by debbugs.gnu.org; 29 Aug 2019 15:44:35 +0000 Original-Received: from localhost ([127.0.0.1]:52824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i3MbC-00028J-UV for submit@debbugs.gnu.org; Thu, 29 Aug 2019 11:44:35 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:41627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i3MbA-00027u-9W for 37217@debbugs.gnu.org; Thu, 29 Aug 2019 11:44:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1567093466; bh=OBZsritmqdteW6XvKUOveiE3Vgd+Z9Qd8Fzf9PQ089g=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=giQIsVvwEio/mQMPU9dUhi5Mfaq5kK27PNgzvlyrDvNUNZL1hhgTZ0tTNPCuoOL5K tnIuZ3xbZzW7yhk1N01c1satEu4HHju4Py2iIiFVIFGOOF2ZWUdx04TRJ9r4w9xUjU WXqi8gvNr6JwmtX8PnU6T3iXi2zh3EdfynVGrOXU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from sheckley.simul.de ([91.11.52.253]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MCwbX-1hthhC3FSt-009dpJ for <37217@debbugs.gnu.org>; Thu, 29 Aug 2019 17:44:25 +0200 Original-Received: from [127.0.0.1] (sheckley.simul.de [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 2C4C41940B9F for <37217@debbugs.gnu.org>; Thu, 29 Aug 2019 17:44:24 +0200 (CEST) Openpgp: preference=signencrypt Autocrypt: addr=Wolfgang.Scherer@gmx.de; prefer-encrypt=mutual; keydata= xsDiBEb46IgRBACMHOAb1KNo1Ylk+ebri+4R+bG4tyKlqBlrpv8D9/ZwRdXSGt+0DyCHoaAd 7KW7noHapLe87DunABOjKG4nqTGv+dRiWuUBlp3I4aYRFDVa3Da+XnIYkMHKqhK59VEHQCdp Km42nuLS7TS+n99at9YwzTG6VBdOlBKTlRFngOjVLwCg1RGXJ6X3EjS1FKCQeXziURVpWlkD /2zY6Ayhxi62TS84VjikXrrmjXykAAaAmMVEyKKYb9L5pGlqiZz9g/K9xw1EUoZTYuaufquD v4rAGR58K/3V4CYfJLEeshMWiaXHvMmlxMznlG16/um4MvmR8B3r+cx0nOPK1JBdD2qrkNnF Mw8FB+zouLFB4Gt2IUC5IlOmZ8OQA/4qdU53CItzWsCr9Nux4L0qUlRweSmCnV8xGQ2wP5XI MawIQxxREvSrsYDG8cNnYETMg4iQFfIktwAoxCJvuFAwIB6ZxHGF4FcEZm64CXc2u7CmFLqt rVhXhIfMz9oEYC+HhGczGamn9ofbG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84WAMwz8+eFMInaMO4iAQdBZ VjPQSUZVFkThMVleoQhCwO2ZgJ4mxIZokIugsoCHTRBNBBat+yHx4QpDh2yc7ZHoEcV0hmIWl LXD6cdmP1CKRszmDszng4wFtxmyg1dtVrqPODdmN9QkxxYBklti9iSbLWsBhMxSBDz+HbUDfy wYrCZQOki78SXxayinVy5Y/Nnzb806CnCvDfnZHjqXIs0XemP9vQmNBxcmwBtH0/fGK/xZuae 3LyDhvZKG3al0udoCONWFHDZZTKrS++sl4tUrLy9i7s5I4dyARXAqPwXaFLZI/HNtkrcqKiP 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: 209.51.188.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:166051 Archived-At: This is a multi-part message in MIME format. --------------C10DB4A3B55AFBC7D5359829 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit A unit test showed, that the removal regexp was faulty. New version of patch attached. --------------C10DB4A3B55AFBC7D5359829 Content-Type: text/x-patch; name="0001-Fix-vc-default-ignore.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Fix-vc-default-ignore.patch" =46rom d2638e621c8da1f93345a5d87691b165d5a05569 Mon Sep 17 00:00:00 2001 From: Wolfgang Scherer Date: Thu, 29 Aug 2019 17:39:21 +0200 Subject: [PATCH] Fix vc-default-ignore * lisp/vc/vc.el: (vc-default-ignore) Treat FILE parameter as relative to DIRECTORY parameter. Construct a file-path relative to directory of ignore file. When removing, use properly anchored regexp. Remove entire line, not just the match. =2D-- lisp/vc/vc.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 4cac153..c982b02 100644 =2D-- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1417,17 +1417,22 @@ remove from the list of ignored files." (defun vc-default-ignore (backend file &optional directory remove) "Ignore FILE under the VCS of DIRECTORY (default is `default-directory'= ). -FILE is a file wildcard, relative to the root directory of DIRECTORY. +FILE is a wildcard specification, either relative to +DIRECTORY or absolute. When called from Lisp code, if DIRECTORY is non-nil, the repository to use will be deduced by DIRECTORY; if REMOVE is non-nil, remove FILE from ignored files. Argument BACKEND is the backend you are using." (let ((ignore (vc-call-backend backend 'find-ignore-file (or directory default-direct= ory))) - (pattern (file-relative-name - (expand-file-name file) (file-name-directory file)))) + file-path root-dir pattern) + (setq file-path (expand-file-name file directory)) + (setq root-dir (file-name-directory ignore)) + (when (not (string=3D (substring file-path 0 (length root-dir)) root-= dir)) + (error "Ignore spec %s is not below project root %s" file-path root= -dir)) + (setq pattern (substring file-path (length root-dir))) (if remove - (vc--remove-regexp pattern ignore) + (vc--remove-regexp (concat "^" (regexp-quote pattern ) "\\(\n\\|$\\)") i= gnore) (vc--add-line pattern ignore)))) (defun vc-default-ignore-completion-table (backend file) =2D- 2.7.4 --------------C10DB4A3B55AFBC7D5359829--