GNU bug report logs - #65704
29.1; Most code of `project-ignores' seems to be dead code

Previous Next

Package: emacs;

Reported by: Damien Cassou <damien <at> cassou.me>

Date: Sat, 2 Sep 2023 16:04:01 UTC

Severity: wishlist

Found in version 29.1

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#65704: closed (29.1; Most code of `project-ignores' seems to
 be dead code)
Date: Wed, 06 Sep 2023 21:17:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 7 Sep 2023 00:16:42 +0300
with message-id <76be9234-5196-a989-785b-558d4956eb48 <at> gutov.dev>
and subject line Re: bug#65704: 29.1; Most code of `project-ignores' seems to be dead code
has caused the debbugs.gnu.org bug report #65704,
regarding 29.1; Most code of `project-ignores' seems to be dead code
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
65704: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65704
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Damien Cassou <damien <at> cassou.me>
To: bug-gnu-emacs <at> gnu.org
Cc: Dmitry Gutov <dgutov <at> yandex.ru>
Subject: 29.1; Most code of `project-ignores' seems to be dead code
Date: Sat, 02 Sep 2023 18:03:04 +0200
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?

This code seems to have been introduced in commit
785fa801596ad7bb9f838cac865f00de29e253d1 "New user option:
project-vc-extra-root-markers".

Best

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill


[Message part 3 (message/rfc822, inline)]
From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Damien Cassou <damien <at> cassou.me>, 65704-done <at> debbugs.gnu.org
Subject: Re: bug#65704: 29.1; Most code of `project-ignores' seems to be dead
 code
Date: Thu, 7 Sep 2023 00:16:42 +0300
On 06/09/2023 22:12, Damien Cassou wrote:
> Dmitry Gutov<dmitry <at> gutov.dev>  writes:
>> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
>> index 29a81c7e151..2eea0ef72e0 100644
>> --- a/lisp/progmodes/project.el
>> +++ b/lisp/progmodes/project.el
>> @@ -566,6 +566,12 @@ project-try-vc
>>                   (project--submodule-p root))
>>              (let* ((parent (file-name-directory (directory-file-name
>> root))))
>>                (setq root (vc-call-backend 'Git 'root parent))))
>> +        (when (not backend)
> it seems that `root' is sometimes nil at this point so I would change
> this line to
> 
>    (when (and (not backend) root)
> 
> I've used this for the day and it seems to work fine.

Thanks for the extra testing.

I just moved the new code a little deeper down inside (when root ...) 
block, should do the same. Pushed as 62229fb2d11 and bumped project.el 
version to 0.10.0.

Should be out in ELPA shortly along with a few other new features added 
recently.

This seems to resolve the last of the concerns here, so closing the bug 
as well. Please clarify if something remains.

Addendum regarding the chosen solution: I guess there is a downside or 
two: when working over Tramp, the latency will increase. And if the 
subproject's dir is in the parent's .gitignore, the behavior will get worse.

Let's wait for feedback to see if those are real problems, but worst 
case, the solution which you had used previously should take care at 
least of the second usage scenario (ignoring the ignores).


This bug report was last modified 1 year and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.