Re: [PATCH 1/2] store submodule in common dir

2 messages, 2 authors, 2018-08-14 · open the first message on its own page

Re: [PATCH 1/2] store submodule in common dir

From: Junio C Hamano <hidden>
Date: 2018-08-14 23:04:41

Stefan Beller [off-list ref] writes:
Signed-off-by: Stefan Beller <redacted>
---
 path.c | 1 +
 1 file changed, 1 insertion(+)
 
On Tue, Aug 14, 2018 at 3:27 PM Joakim Tjernlund [off-list ref] wrote:
quoted
I am trying to create 3 submodules from the same git repo, each pointing to a different branch.
Since the repo is somewhat large, I don't want the 3 submodules to clone the same repo 3
times, I want one clone and then have the 3 submodules to point to different commits.

Is this possible? If not, could it be added?
yup.

According to recent discussions, it would be just this patch.
(plus some unspecified amount of work, TBD).

I thought about proposing something proper later, but here is the WIP patch.

Thanks,
Stefan 
My understanding of what Joakim wants to do is to have a top-level
project that has three subdirectories, e.g. kernel/v2.2, kernel/v2.4
and kernel/v2.6, each of which is a submodule that houses these
versions of Linux kernel source, but only clone Linus's repository
(as the up-to-late tree has all the necessary history to check out
these past development tracks).  And that should be doable with
just the main checkout, without any additional worktree (it's just
the matter of having .git/modules/kernel%2fv2.6/ directory pointed
by two symlinks from .git/modules/kernel%2fv2.[24], or something
like that).

Isn't "common_dir" stuff used to decide if each of separate
"worktree" instance (of the superproject) shares ".git/$stuff"
with each other?

Unless I am grossly misinterpreting the original question, I fail to
see how changing .git/modules to be shared across worktrees possibly
affects anything.  I am puzzled...
quoted hunk
diff --git a/path.c b/path.c
index 34f0f98349a..64c9821b834 100644
--- a/path.c
+++ b/path.c
@@ -115,6 +115,7 @@ static struct common_dir common_list[] = {
 	{ 1, 1, 1, "logs/HEAD" },
 	{ 0, 1, 1, "logs/refs/bisect" },
 	{ 0, 1, 0, "lost-found" },
+	{ 0, 1, 0, "modules" },
 	{ 0, 1, 0, "objects" },
 	{ 0, 1, 0, "refs" },
 	{ 0, 1, 1, "refs/bisect" },

Re: [PATCH 1/2] store submodule in common dir

From: Stefan Beller <hidden>
Date: 2018-08-14 23:23:24

On Tue, Aug 14, 2018 at 4:04 PM Junio C Hamano [off-list ref] wrote:
Stefan Beller [off-list ref] writes:
quoted
Signed-off-by: Stefan Beller <redacted>
---
 path.c | 1 +
 1 file changed, 1 insertion(+)

On Tue, Aug 14, 2018 at 3:27 PM Joakim Tjernlund [off-list ref] wrote:
quoted
I am trying to create 3 submodules from the same git repo, each pointing to a different branch.
Since the repo is somewhat large, I don't want the 3 submodules to clone the same repo 3
times, I want one clone and then have the 3 submodules to point to different commits.

Is this possible? If not, could it be added?
yup.

According to recent discussions, it would be just this patch.
(plus some unspecified amount of work, TBD).

I thought about proposing something proper later, but here is the WIP patch.

Thanks,
Stefan
My understanding of what Joakim wants to do is to have a top-level
project that has three subdirectories, e.g. kernel/v2.2, kernel/v2.4
and kernel/v2.6, each of which is a submodule that houses these
versions of Linux kernel source, but only clone Linus's repository
(as the up-to-late tree has all the necessary history to check out
these past development tracks).  And that should be doable with
just the main checkout, without any additional worktree (it's just
the matter of having .git/modules/kernel%2fv2.6/ directory pointed
by two symlinks from .git/modules/kernel%2fv2.[24], or something
like that).
Ah! I misunderstood due to fast reading.

For that I think you are interested in the feature added in d92a39590d1
(Add --reference option to git submodule., 2009-05-04), i.e.
both the update and add command take the --reference flag
that can be pointed at another repository such as an outside
clone of these three submodules, so some deduplication will
be performed.
Isn't "common_dir" stuff used to decide if each of separate
"worktree" instance (of the superproject) shares ".git/$stuff"
with each other?

Unless I am grossly misinterpreting the original question, I fail to
see how changing .git/modules to be shared across worktrees possibly
affects anything.  I am puzzled...
I did misunderstand grossly.

Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help