Subject: bug#59722: 30.0.50; project-find-regexp searches project-ignored files

From: Rudolf Adamkovič <[email-masked]>
Date: Sun, 11 Dec 2022 13:38:53 +0100

Dmitry Gutov <[email-masked]> writes:

>>    ((nil . ((project-ignores . ("apps/**/*.scm")))))
>
> project-vc-ignores, you mean.

Correct.  Dmitry, I apologize for causing confusion!

>> 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.

In summary, any symlinks to directories shallow-appear in `git ls-files'
outputs.  Emacs hands the list to Ripgrep, and Ripgrep follows symlinks,
possibly searching through ignored directories, effectively ignoring
`project-vc-ignores' from the point of view of the user.

Phew!

Rudy
-- 
"The introduction of suitable abstractions is our only mental aid to
organize and master complexity."
-- Edsger Wybe Dijkstra, 1930-2002

Rudolf Adamkovič <[email-masked]> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia