unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74614: Problem of finding the project root when working on submodules of a submodule
@ 2024-11-30  2:35 Chu Maeda
  2024-12-02  2:14 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Chu Maeda @ 2024-11-30  2:35 UTC (permalink / raw)
  To: 74614

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 444 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#74614: Problem of finding the project root when working on submodules of a submodule
  2024-11-30  2:35 bug#74614: Problem of finding the project root when working on submodules of a submodule Chu Maeda
@ 2024-12-02  2:14 ` Dmitry Gutov
       [not found]   ` <CAEhDdq9pdB9HP9M61_Hs7Dh0ea3=oLBjwxwDnh1KGHHO=z1WcQ@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2024-12-02  2:14 UTC (permalink / raw)
  To: Chu Maeda, 74614

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?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#74614: Fwd: bug#74614: Problem of finding the project root when working on submodules of a submodule
       [not found]   ` <CAEhDdq9pdB9HP9M61_Hs7Dh0ea3=oLBjwxwDnh1KGHHO=z1WcQ@mail.gmail.com>
@ 2024-12-02  5:15     ` Chu Maeda
  2024-12-03  2:14       ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Chu Maeda @ 2024-12-02  5:15 UTC (permalink / raw)
  To: 74614

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

---------- Forwarded message ---------
发件人: Chu Maeda <maedaqu@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@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)

[-- Attachment #2: Type: text/html, Size: 970 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#74614: Fwd: bug#74614: Problem of finding the project root when working on submodules of a submodule
  2024-12-02  5:15     ` bug#74614: Fwd: " Chu Maeda
@ 2024-12-03  2:14       ` Dmitry Gutov
  2024-12-03  2:25         ` Chu Maeda
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2024-12-03  2:14 UTC (permalink / raw)
  To: Chu Maeda, 74614

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.





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#74614: Fwd: bug#74614: Problem of finding the project root when working on submodules of a submodule
  2024-12-03  2:14       ` Dmitry Gutov
@ 2024-12-03  2:25         ` Chu Maeda
  2024-12-03  2:39           ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Chu Maeda @ 2024-12-03  2:25 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 74614

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

It works. Thanks.

Dmitry Gutov <dmitry@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.
>

[-- Attachment #2: Type: text/html, Size: 1875 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#74614: Fwd: bug#74614: Problem of finding the project root when working on submodules of a submodule
  2024-12-03  2:25         ` Chu Maeda
@ 2024-12-03  2:39           ` Dmitry Gutov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2024-12-03  2:39 UTC (permalink / raw)
  To: Chu Maeda; +Cc: 74614-done

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@gutov.dev <mailto:dmitry@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.
> 






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-03  2:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-30  2:35 bug#74614: Problem of finding the project root when working on submodules of a submodule Chu Maeda
2024-12-02  2:14 ` Dmitry Gutov
     [not found]   ` <CAEhDdq9pdB9HP9M61_Hs7Dh0ea3=oLBjwxwDnh1KGHHO=z1WcQ@mail.gmail.com>
2024-12-02  5:15     ` bug#74614: Fwd: " Chu Maeda
2024-12-03  2:14       ` Dmitry Gutov
2024-12-03  2:25         ` Chu Maeda
2024-12-03  2:39           ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).