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#37215: [PATCH] vc-cvs-ignore writes absolute filenames and duplicate strings Date: Thu, 29 Aug 2019 00:32:22 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------3FBEAFDFBD64FCA29D5F1499" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="150815"; 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: 37215@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 29 00:33:38 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 1i36VW-000d7o-4x for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Aug 2019 00:33:38 +0200 Original-Received: from localhost ([::1]:43388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i36VU-000256-9v for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Aug 2019 18:33:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45480) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i36Ux-00024W-J4 for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:33:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i36Uw-0002sL-DX for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:33:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42544) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i36Uw-0002sD-AX for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i36Uw-0006oF-6t for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:33: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: Wed, 28 Aug 2019 22:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Emacs Bugs Original-Received: via spool by submit@debbugs.gnu.org id=B.156703155326120 (code B ref -1); Wed, 28 Aug 2019 22:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Aug 2019 22:32:33 +0000 Original-Received: from localhost ([127.0.0.1]:51365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i36US-0006nE-MQ for submit@debbugs.gnu.org; Wed, 28 Aug 2019 18:32:32 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i36UR-0006n6-1B for submit@debbugs.gnu.org; Wed, 28 Aug 2019 18:32:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45277) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i36UP-0001uv-NG for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:32:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i36UO-0002T8-Jg for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:32:29 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:49893) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i36UO-0002S3-2D for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 18:32:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1567031544; bh=jb0cMdUAvfUBqaW6ZYQf2dbhAx9JkXoEpIKk/W335Z0=; h=X-UI-Sender-Class:To:From:Subject:Date; b=AbxWHfyv4Er5gT54/3bqQ+tOUGqwBQrp9jzvcovY/OwiW215xoljEas/fL1jaWHJM PG/dhmGzWb7FYKa6Dtxc2HPfLm9yNWNBReVTQRkvW252rdZdPhQRmaLU6JE08bkkJP lmi+YcAwXqrYBrx4SUW2bvfWQl5YNZoPxy3T/m/4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from sheckley.simul.de ([87.144.41.174]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MIMbO-1hxexg1Key-00EMwo for ; Thu, 29 Aug 2019 00:32:24 +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 BA98D1942AFF for ; Thu, 29 Aug 2019 00:32:22 +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 /2zY6Ayhxi62TS84VjikXrrmjXykAAaAmMVEy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yUC 657Tcok0Ds3sooSzDCds5gN2aIl/plrEfDMqR3zUhUwS1J7d3D/K4qoDQzTjNHk5H5BMVRqpD sC3FVk+XAAxqTeWDwZluLK4nT6hEPMNrcJYl4iqYtt5YdgNmCbUyD1diqb4I7OGES3vFZwSco 5CgAOtgRc8q5OBrQ/5KbKKmdghfPDR44fVdJcg8v7QxLKN+1XTvEl+1mI61Im0v9sYMj7lbHI ZEjlbZAmv7sIjrW7Ya3AcF4XND88NAaMg3gRzncKubjRyQheSq1TdwIj6TW2pVUgQhd8tLeC9 Vtq2GpVNtXwBeYxFt8/WGdCgBnECWI2GE1V721Ki8X9w/I6NyjZp2uH1ygxI4odACdOo6M0mC yP5sA2bxvOOXn+KTlSuc1D3iX+fo5dktSidiHUr1+CEdI7EViM0aV7KQ3Jv6BGomL5g9NKpLF qG5DRpxiRQNRYllK35gDSTaEzv/Ke2b0ESGI8Re0DaprP8WeKl9qYmj4AUUaAizaYFc1nk2Ro shHUv58WiQed5Qmy2dOk9ZmKZxGtFJI2yKT2js5K+w4tUgE9lSv2Iu6Bc19SEclJNnPE65Fl X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:166029 Archived-At: This is a multi-part message in MIME format. --------------3FBEAFDFBD64FCA29D5F1499 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit When called with an absolute filename (which is the default case), `vc-cvs-ignore' writes the entire path into the .cvsignore file. `vc-cvs-ignore' also writes duplicate strings into .cvsignore. The attached patch fixes these errors. --------------3FBEAFDFBD64FCA29D5F1499 Content-Type: text/x-patch; name="0001-Do-not-write-absolute-filenames-and-duplicate-string.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-Do-not-write-absolute-filenames-and-duplicate-string.pa"; filename*1="tch" =46rom 2b7b90b94a426754a99c965bf708bf5854008b76 Mon Sep 17 00:00:00 2001 From: Wolfgang Scherer Date: Thu, 29 Aug 2019 00:29:31 +0200 Subject: [PATCH] Do not write absolute filenames and duplicate strings int= o .cvsignore * lisp/vc/vc-cvs.el: (vc-cvs-ignore) Expand filename correctly and pass on basename only. (vc-cvs-append-to-ignore) Do not write duplicate strings to .cvsignore. =2D-- lisp/vc/vc-cvs.el | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index d84700f..1d0387b 100644 =2D-- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -1220,9 +1220,11 @@ is non-nil." "Return the administrative directory of FILE." (vc-find-root file "CVS")) -(defun vc-cvs-ignore (file &optional _directory _remove) - "Ignore FILE under CVS." - (vc-cvs-append-to-ignore (file-name-directory file) file)) +(defun vc-cvs-ignore (file &optional directory _remove) + "Ignore FILE under CVS. +FILE is either absolute or relative to DIRECTORY." + (setq file (directory-file-name (expand-file-name file directory))) + (vc-cvs-append-to-ignore (file-name-directory file) (file-name-nondirec= tory file))) (defun vc-cvs-append-to-ignore (dir str &optional old-dir) "In DIR, add STR to the .cvsignore file. @@ -1236,13 +1238,16 @@ to hear about anymore." (not (vc-editable-p buffer-file-name)))) ;; CVSREAD=3Don special case (vc-checkout buffer-file-name t)) - (goto-char (point-max)) - (unless (bolp) (insert "\n")) - (insert str (if old-dir "/\n" "\n")) - ;; FIXME this is a pcvs variable. - (if (bound-and-true-p cvs-sort-ignore-file) - (sort-lines nil (point-min) (point-max))) - (save-buffer))) + (goto-char (point-min)) + (save-match-data + (unless (re-search-forward (concat "^" (regexp-quote str) "$") nil = t) + (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (insert str (if old-dir "/\n" "\n")) + ;; FIXME this is a pcvs variable. + (if (bound-and-true-p cvs-sort-ignore-file) + (sort-lines nil (point-min) (point-max))) + (save-buffer))))) (provide 'vc-cvs) =2D- 2.7.4 --------------3FBEAFDFBD64FCA29D5F1499--