From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#37189: 25.4.1: vc-hg-ignore implementation is missing Date: Fri, 14 Feb 2020 11:23:19 +0200 Message-ID: <83ftfdplo8.fsf@gnu.org> References: <1ba53ae2-42a4-3ab3-d4f2-2ceae565d198@gmx.de> <412195c1-e196-12af-933b-0312f5075847@yandex.ru> <57825d73-27a4-d5f5-8198-a172796a558a@gmx.de> <1ebc6077-9175-65ba-4996-282bb2c8eca5@yandex.ru> <6145d6f6-37a8-7166-731b-57669086b145@gmx.de> <838slmk90j.fsf@gnu.org> <83h806gp2w.fsf@gnu.org> <8336bmg1o9.fsf@gnu.org> <2354821b-5c1e-f9e3-3a64-4ff978ded33b@gmx.de> <83sgjkdev5.fsf@gnu.org> <3fb73dbc-bf31-233b-4afc-2147c4ffd5b7@gmx.de> <5622487d-a21f-49cf-5420-21f87415af4f@gmx.de> <83wo8ubfbo.fsf@gnu.org> <83zhdpqbas.fsf@gnu.org> <2c8419ae-723d-c7ae-a60e-59d1b1cbc2c1@gmx.de> <83o8u3r6wg.fsf@gnu.org> <6f3ba261-e1f9-cf19-cc22-ec8c24cf3298@gmx.de> <83blq2qzqp.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="53424"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 37189@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 14 10:24:11 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 1j2XCk-000Dld-Tq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Feb 2020 10:24:11 +0100 Original-Received: from localhost ([::1]:36470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2XCj-0004cX-PQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Feb 2020 04:24:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49027) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2XCd-0004cQ-SH for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 04:24:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2XCc-0003l9-N7 for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 04:24:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2XCc-0003kg-KA for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 04:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j2XCc-0008Ic-Cb for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2020 04:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Feb 2020 09:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37189 X-GNU-PR-Package: emacs Original-Received: via spool by 37189-submit@debbugs.gnu.org id=B37189.158167220231851 (code B ref 37189); Fri, 14 Feb 2020 09:24:02 +0000 Original-Received: (at 37189) by debbugs.gnu.org; 14 Feb 2020 09:23:22 +0000 Original-Received: from localhost ([127.0.0.1]:60851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2XBx-0008Hf-R5 for submit@debbugs.gnu.org; Fri, 14 Feb 2020 04:23:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2XBw-0008HT-Tz for 37189@debbugs.gnu.org; Fri, 14 Feb 2020 04:23:21 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j2XBr-0002iC-Eh; Fri, 14 Feb 2020 04:23:15 -0500 Original-Received: from [176.228.60.248] (port=3816 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j2XBq-0002Hb-R5; Fri, 14 Feb 2020 04:23:15 -0500 In-reply-to: (message from Dmitry Gutov on Fri, 14 Feb 2020 01:40:31 +0200) 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176039 Archived-At: > Cc: 37189@debbugs.gnu.org > From: Dmitry Gutov > Date: Fri, 14 Feb 2020 01:40:31 +0200 > > I think the first thing I'll have to do is revert a part of an earlier > patch to vc-default-ignore which changed its semantics a little, because > it doesn't look like this discussion is going to culminate in a patch > small enough for emacs-27 anyway. Which part? Can you show a proposed patch? > Then, naturally, we'll have to look for small changes that improve the > situation but provide as little breakage as possible. Agreed. > > I did arrive at a few conclusions after studying the issues raised in > > the discussions, so if you want, I can post those conclusions FTR, if > > for nothing else. > > Yes, of course, please go ahead. OK, here goes: 1) vc-dir-ignore: It calculates the file name for the entry into the ignore file, and thus must escape any characters in the file name that are special in ignore files -- which is backend-specific. The file name should also be "anchored", at least ideally, so that no other file is accidentally ignored. This is also backend-specific. VC's support for directory-specific ignore files is inconsistent: they are supported for CVS (and actually mandatory there) and maybe SVN, but not for Git/Bazaar/Mercurial/Monotone -- for the latter we only support ignore files in the repository root. This could be improved in the future, but for now I don't see an immediate need. The fact that vc-dir-ignore calls vc-ignore produces contradictions, because vc-ignore is supposed to handle file-name patterns (whether wildcards or regexps), whereas vc-dir-ignore never sends patterns, and also because with vc-ignore the user should get to decide whether to anchor the file name or pattern. So I think vc-dir-ignore's implementation should be eventually rewritten to call the backends directly instead of relying on vc-ignore. 2) vc-ignore: Prompts the user for the file name or pattern to add to the ignore file, and therefore the escaping and anchoring is the user's responsibility. It should basically just find the ignore file and add/remove an entry to/from there. It should not assume the argument is a simple file name, therefore using the likes of expand-file-name and file-name-nondirectory is not a good idea. For example, Git patterns that are "anchored" start with a slash, which will cause unexpected results if used in a "file name". As another example, backslashes used for escaping special characters will be interpreted on Windows as directory separators, again leading to unexpected results. Therefore, vc-default-ignore should not use file-name related primitives, but instead use concat and substring (if needed). For the same reason, using read-file-name here is too naïve, as well as yielding an absolute file name from what the user types. If you agree with the above, we then need to decide what, if anything, of this should be fixed for Emacs 27. E.g., vc-dir-ignore seems to be OK if the file name doesn't include special characters, does it? Thanks.