Subject: Re: bug#65704: 29.1; Most code of `project-ignores' seems to be dead code

From: Dmitry Gutov <[email-masked]>
Date: Sun, 3 Sep 2023 03:26:48 +0300

Hi Damien,

Thanks for the patch, pushed to master (with a few amendments in summary).

I'd like to backport it to emacs-29 as well, if Eli/Stefan don't mind.

On 02/09/2023 19:03, Damien Cassou wrote:
> Hi,
> 
> The function `project-ignores' starts like this:
> 
>    (cl-defmethod project-ignores ((project (head vc)) dir)
>      (let* ((root (nth 2 project))
>             backend)
>        (append
>         (when (and backend
>                    (file-equal-p dir root))
> 
> It seems to me that `backend' is always going to be nil at this point
> and thus the 25-line long `when' block will always return nil without
> doing anything.
> 
> Am I missing something?

Not much. Maybe just that that code path isn't exercised by any in-tree 
function if the backend is Git (with recent enough git installed) or Hg 
(the project-files method uses faster, specialized shell invocations), 
so that might be the reason why this was missed in testing.

Any chance you could tell us what made you notice the bug?