GNU bug report logs - #74614
Problem of finding the project root when working on submodules of a submodule

Previous Next

Package: emacs;

Reported by: Chu Maeda <maedaqu <at> gmail.com>

Date: Sat, 30 Nov 2024 02:36:01 UTC

Severity: normal

Fixed in version 31.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74614 in the body.
You can then email your comments to 74614 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#74614; Package emacs. (Sat, 30 Nov 2024 02:36:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chu Maeda <maedaqu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 30 Nov 2024 02:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chu Maeda <maedaqu <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Problem of finding the project root when working on submodules of a
 submodule
Date: Sat, 30 Nov 2024 10:35:19 +0800
[Message part 1 (text/plain, inline)]
Assume that there's a git repository A. A has a submodule B. B has a
submodule C.

When I'm working on C, the current implementation won't choose A as the
project root even though the project-vc-merge-submodules is non-nil.

I can customize project-find-functions to find the right project root as a
workaround, but I think this might be a bug need to be fixed.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74614; Package emacs. (Mon, 02 Dec 2024 02:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 74614 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Chu Maeda <maedaqu <at> gmail.com>, 74614 <at> debbugs.gnu.org
Subject: Re: bug#74614: Problem of finding the project root when working on
 submodules of a submodule
Date: Mon, 2 Dec 2024 04:14:02 +0200
Hi!

On 30/11/2024 04:35, Chu Maeda wrote:
> Assume that there's a git repository A. A has a submodule B. B has a 
> submodule C.
> 
> When I'm working on C, the current implementation won't choose A as the 
> project root even though the project-vc-merge-submodules is non-nil.
> 
> I can customize project-find-functions to find the right project root as 
> a workaround, but I think this might be a bug need to be fixed.

Could you post a sequence of commands one can/should use to recreate 
such a project?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74614; Package emacs. (Mon, 02 Dec 2024 05:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 74614 <at> debbugs.gnu.org (full text, mbox):

From: Chu Maeda <maedaqu <at> gmail.com>
To: 74614 <at> debbugs.gnu.org
Subject: Fwd: bug#74614: Problem of finding the project root when working on
 submodules of a submodule
Date: Mon, 2 Dec 2024 13:15:01 +0800
[Message part 1 (text/plain, inline)]
---------- Forwarded message ---------
发件人: Chu Maeda <maedaqu <at> gmail.com>
Date: 2024年12月2日周一 13:13
Subject: Re: bug#74614: Problem of finding the project root when working on
submodules of a submodule
To: Dmitry Gutov <dmitry <at> gutov.dev>


Of course, I created such a project on github, you could clone it by
command:

git clone --recurse-submodules https://github.com/chu-mirror/A.git

The problem is clear when you open the file A/B/C/README.md, and run
command project-find-file(C-x p f by default)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74614; Package emacs. (Tue, 03 Dec 2024 02:16:02 GMT) Full text and rfc822 format available.

Message #14 received at 74614 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Chu Maeda <maedaqu <at> gmail.com>, 74614 <at> debbugs.gnu.org
Subject: Re: bug#74614: Fwd: bug#74614: Problem of finding the project root
 when working on submodules of a submodule
Date: Tue, 3 Dec 2024 04:14:58 +0200
On 02/12/2024 07:15, Chu Maeda wrote:
> 
> Of course, I created such a project on github, you could clone it by 
> command:
> 
> git clone --recurse-submodules https://github.com/chu-mirror/A.git 
> <https://github.com/chu-mirror/A.git>
> 
> The problem is clear when you open the file A/B/C/README.md, and run 
> command project-find-file(C-x p f by default)

Thanks!

It seems we should switch from checking for modules once to doing it in 
a loop. Try this out:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index cf1c94a6d20..3cc063a5d99 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -591,7 +591,7 @@ project-try-vc--search
                      last-matches))
            vc-handled-backends))
          project)
-    (when (and
+    (while (and
            (eq backend 'Git)
            (project--vc-merge-submodules-p root)
            (project--submodule-p root))

Note you might need to restart Emacs after applying the patch, because 
the directory->project relation is currently cached until restart.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74614; Package emacs. (Tue, 03 Dec 2024 02:27:01 GMT) Full text and rfc822 format available.

Message #17 received at 74614 <at> debbugs.gnu.org (full text, mbox):

From: Chu Maeda <maedaqu <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 74614 <at> debbugs.gnu.org
Subject: Re: bug#74614: Fwd: bug#74614: Problem of finding the project root
 when working on submodules of a submodule
Date: Tue, 3 Dec 2024 10:25:14 +0800
[Message part 1 (text/plain, inline)]
It works. Thanks.

Dmitry Gutov <dmitry <at> gutov.dev> 于2024年12月3日周二 10:15写道:

> On 02/12/2024 07:15, Chu Maeda wrote:
> >
> > Of course, I created such a project on github, you could clone it by
> > command:
> >
> > git clone --recurse-submodules https://github.com/chu-mirror/A.git
> > <https://github.com/chu-mirror/A.git>
> >
> > The problem is clear when you open the file A/B/C/README.md, and run
> > command project-find-file(C-x p f by default)
>
> Thanks!
>
> It seems we should switch from checking for modules once to doing it in
> a loop. Try this out:
>
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index cf1c94a6d20..3cc063a5d99 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -591,7 +591,7 @@ project-try-vc--search
>                        last-matches))
>              vc-handled-backends))
>            project)
> -    (when (and
> +    (while (and
>              (eq backend 'Git)
>              (project--vc-merge-submodules-p root)
>              (project--submodule-p root))
>
> Note you might need to restart Emacs after applying the patch, because
> the directory->project relation is currently cached until restart.
>
[Message part 2 (text/html, inline)]

Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Tue, 03 Dec 2024 02:40:01 GMT) Full text and rfc822 format available.

Notification sent to Chu Maeda <maedaqu <at> gmail.com>:
bug acknowledged by developer. (Tue, 03 Dec 2024 02:40:01 GMT) Full text and rfc822 format available.

Message #22 received at 74614-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Chu Maeda <maedaqu <at> gmail.com>
Cc: 74614-done <at> debbugs.gnu.org
Subject: Re: bug#74614: Fwd: bug#74614: Problem of finding the project root
 when working on submodules of a submodule
Date: Tue, 3 Dec 2024 04:39:35 +0200
Version: 31.1

On 03/12/2024 04:25, Chu Maeda wrote:
> It works. Thanks.

Thanks for testing, pushed to master now in 8534bb2d6b5.

> Dmitry Gutov <dmitry <at> gutov.dev <mailto:dmitry <at> gutov.dev>> 于2024年12月3 
> 日周二 10:15写道:
> 
>     On 02/12/2024 07:15, Chu Maeda wrote:
>      >
>      > Of course, I created such a project on github, you could clone it by
>      > command:
>      >
>      > git clone --recurse-submodules https://github.com/chu-mirror/
>     A.git <https://github.com/chu-mirror/A.git>
>      > <https://github.com/chu-mirror/A.git <https://github.com/chu-
>     mirror/A.git>>
>      >
>      > The problem is clear when you open the file A/B/C/README.md, and run
>      > command project-find-file(C-x p f by default)
> 
>     Thanks!
> 
>     It seems we should switch from checking for modules once to doing it in
>     a loop. Try this out:
> 
>     diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
>     index cf1c94a6d20..3cc063a5d99 100644
>     --- a/lisp/progmodes/project.el
>     +++ b/lisp/progmodes/project.el
>     @@ -591,7 +591,7 @@ project-try-vc--search
>                             last-matches))
>                   vc-handled-backends))
>                 project)
>     -    (when (and
>     +    (while (and
>                   (eq backend 'Git)
>                   (project--vc-merge-submodules-p root)
>                   (project--submodule-p root))
> 
>     Note you might need to restart Emacs after applying the patch, because
>     the directory->project relation is currently cached until restart.
> 





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 31 Dec 2024 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 174 days ago.

Previous Next


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