From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#59722: 30.0.50; project-find-regexp searches project-ignored files Date: Sun, 11 Dec 2022 22:13:04 +0200 Message-ID: <5a3a5634-ef16-1ffd-d436-287725cf4f2c@yandex.ru> References: <9de53f42-8f76-3770-b059-d78a5252d31a@yandex.ru> <1f6b991a-d67e-5e38-b77f-038e97218e4e@yandex.ru> <0810182a-7808-5c7b-91f9-bc76374c3263@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33902"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= , 59722@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 11 21:14:27 2022 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 1p4SiP-0008bZ-Tc for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Dec 2022 21:14:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4Si5-0004oF-5h; Sun, 11 Dec 2022 15:14:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4Si3-0004nn-Dr for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 15:14:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4Si2-0006EJ-Go for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 15:14:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4Si1-0002a5-Rd for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 15:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Dec 2022 20:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59722 X-GNU-PR-Package: emacs Original-Received: via spool by 59722-submit@debbugs.gnu.org id=B59722.16707895949892 (code B ref 59722); Sun, 11 Dec 2022 20:14:01 +0000 Original-Received: (at 59722) by debbugs.gnu.org; 11 Dec 2022 20:13:14 +0000 Original-Received: from localhost ([127.0.0.1]:48002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4ShG-0002ZU-6G for submit@debbugs.gnu.org; Sun, 11 Dec 2022 15:13:14 -0500 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:33456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4ShE-0002ZM-BR for 59722@debbugs.gnu.org; Sun, 11 Dec 2022 15:13:12 -0500 Original-Received: by mail-wm1-f48.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso8494545wmb.0 for <59722@debbugs.gnu.org>; Sun, 11 Dec 2022 12:13:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=nELTCNiKJCWNRLTUqjDH2bs+4KaOLpBXF16DUM8x8XI=; b=VbRaRcSRhdBLoXoS8JXtjQmIbeJLrAlvk/QFTFY71I7JvSMcXtk4K2DkmzFH8+gm0l QKvJNucDt9ZDZStvPwE1zhlKD/iVS4glDLKLibiVLVGeHIFAmgql47XEpPjEeRMtNukq Yh6A7xkbuxN42SyrGRnm7OHiIfF+W3jk60+Ad7DgIwfFeTOY2glcLKSZO9FhsWsb18fx wVTzpmVbWlJq/i01PKtjGScWrpsCmrQxoEQwYSI9nWvJHdsBsVT0QR/tmVghDD0xmAHN CISkPs1ZMNOPhfrrH3Mh2hbsytvgMswEj6NASH9Ujm3wFLHbEnY8fgJmVnL8253Ba7uu rXJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nELTCNiKJCWNRLTUqjDH2bs+4KaOLpBXF16DUM8x8XI=; b=rxHjUtbutZr7CKlXEHuOxyfSgDld5rOZqicrfkzv3roRs/+sZwBX3V3EEZsODQffx1 TL8Ke037rXW2QVFwsOODu4iX8jKy+zCjzQCx7encqnSQtVBLKCQt5vFR5RXUVij5Srvb Ba07rzTtHvUDpjwJ5uT0pJsv1qYjbXqJeCEB40fL82J+UUYds1fZI7eFHJeUn7r/BXiZ KYLY5eDCMYsl7eXoHr4s4MpRqsnBVQxOPw7nqYqcrLvrjvg+ir+8Grx3OJVVjJWM6xWC gDTUnsV/iupwrh5/B4avRybI7Tyvw8olvWQc0HMSj4Yi+xHy30nMapYtmoFa0yLM5tDn QLmQ== X-Gm-Message-State: ANoB5pmUjC8VYDZNiAbc6hwHDT2zBOQVs4OROKHvsRQYBGoBYXsvYeRE u+8IuGbvFetQecjzRYLegTI= X-Google-Smtp-Source: AA0mqf7Z8Zyywo1BOvZ/7jaqG4WWJCticMbS7/mZESMHPrNDrH6Gf9RbnuMFIostp+TLASYT+JhNpQ== X-Received: by 2002:a05:600c:35cb:b0:3cf:360e:f37d with SMTP id r11-20020a05600c35cb00b003cf360ef37dmr11179944wmq.22.1670789586158; Sun, 11 Dec 2022 12:13:06 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id l6-20020a1c7906000000b003cf4eac8e80sm8032312wme.23.2022.12.11.12.13.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Dec 2022 12:13:05 -0800 (PST) Content-Language: en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250654 Archived-At: On 11/12/2022 14:38, Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Dmitry Gutov writes: > >>> ((nil . ((project-ignores . ("apps/**/*.scm"))))) >> >> project-vc-ignores, you mean. > > Correct. Dmitry, I apologize for causing confusion! No problem. I just wanted to make double-sure that the typo is not the cause of the issue. >>> Emacs ends up calling >>> >>> git ls-files -z -c --exclude-standard \ >>> --no-empty-directory -o -- :(exclude,glob,top)apps/**/*.scm >>> >>> [...] >> >> Huh, interesting. Could you try to show a similar command invocation >> which would make Git output include a "logically empty" directory for >> the Emacs repo? So that we have a common public project to compare. > > I could not reproduce the problem with the Emacs source directory, but I > did not give up! And, after a whole lot of head-scratching, I found the > root cause of the problem: > > When `git ls-files' finds a symlink that points to a directory, it does > *not* follow it. Instead, it lists it in the output. In my case, the > symlink pointed to a directory with all of its files ignored. However, > and importantly, upon further testing, I found that ignores do *not* > matter. Okay, yes, that seems to be the case. And there seems to be no way to have 'git ls-files' include symlinks in the output. I can suggest two options here, both non-ideal: - Ignore the whole symlinked directories by adding ignore entries that match their symlink files, rather than directories. For example, by setting project-vc-ignores to '("apps/*") or '("apps/**"), or with individual entries for each of them. That is, if you want them ignored whole. - Here's what seems to be a (Linux-only) way to have Git follow symlinks: https://github.com/Alcaro/GitBSLR (found at https://stackoverflow.com/a/49138555/615245). Another automatic approach would be to add a new value in xref-search-program-alist that would first pipe through a non-symlink-ness checker. Or modify the existing values. But I'm yet to write a suitable command or pipeline (help welcome!), so I'm not sure how practical that is, and what's the average overhead. The obvious choice of (seq-filter #'file-regular-p (project-files (project-current))) creates a large overhead (takes about x3 time here as just listing the files). That too much, I think.