All of lore.kernel.org
 help / color / mirror / Atom feed
* "mixed" or "merged" submodules
@ 2022-07-05 20:35 Sim Tov
  2022-07-06  9:16 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 3+ messages in thread
From: Sim Tov @ 2022-07-05 20:35 UTC (permalink / raw)
  To: git

Hello,

here  https://stackoverflow.com/q/72770397/1876484

I asked this question:

I'm aware of git submodules which dwell each in its own separate directory.

1. But is there such thing as "mixed" submodules whose content is
"merged" together?

For instance:

- Submodule1 (path ./), consist of files `a.txt`, `b.txt` and
directory `C` with the file `1.txt`
- Submodule2 (path ./), consist of files `x.txt`, `y.txt` and
directory `C` with the file `2.txt`
- Resulting "mixed" repo of both submodules: files `a.txt`, `b.txt`,
`x.txt`, `y.txt` and directory `C` with the files `1.txt`, `2.txt`

2. If it is not implemented in git - is there a workaround to achieve this?

Here my use case:

Both submodules - independent libraries (collection of books as plain
text files), which have same structure (directories = book
categories). I want to present the combined parent git repository as
full collection of books, while both projects evolve independently and
do not overlap (in terms of file names = books).

I got a very detailed and informative answer. My question now - do you
see any other practical use cases for such a feature? Would such a
more general case of submodules be a good feature in git or not?

Thank you!

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

* Re: "mixed" or "merged" submodules
  2022-07-05 20:35 "mixed" or "merged" submodules Sim Tov
@ 2022-07-06  9:16 ` Ævar Arnfjörð Bjarmason
  2022-07-06 12:28   ` Sim Tov
  0 siblings, 1 reply; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-07-06  9:16 UTC (permalink / raw)
  To: Sim Tov; +Cc: git


On Tue, Jul 05 2022, Sim Tov wrote:

> Hello,
>
> here  https://stackoverflow.com/q/72770397/1876484
>
> I asked this question:
>
> I'm aware of git submodules which dwell each in its own separate directory.
>
> 1. But is there such thing as "mixed" submodules whose content is
> "merged" together?
>
> For instance:
>
> - Submodule1 (path ./), consist of files `a.txt`, `b.txt` and
> directory `C` with the file `1.txt`
> - Submodule2 (path ./), consist of files `x.txt`, `y.txt` and
> directory `C` with the file `2.txt`
> - Resulting "mixed" repo of both submodules: files `a.txt`, `b.txt`,
> `x.txt`, `y.txt` and directory `C` with the files `1.txt`, `2.txt`
>
> 2. If it is not implemented in git - is there a workaround to achieve this?
>
> Here my use case:
>
> Both submodules - independent libraries (collection of books as plain
> text files), which have same structure (directories = book
> categories). I want to present the combined parent git repository as
> full collection of books, while both projects evolve independently and
> do not overlap (in terms of file names = books).
>
> I got a very detailed and informative answer. My question now - do you
> see any other practical use cases for such a feature? Would such a
> more general case of submodules be a good feature in git or not?

Good question, but to answer the thought experiment don't conflate
submodules with this, instead suppose that you have two branches A & B,
which have:

    A: A.txt
    B: B.txt

How will you create and maintain a third branch C which has the union of
the two?

The answer to that question will be the same as with the submodule case,
i.e. you'd need to have some third branch that you maintain (e.g. with a
push hook?) that would be a merge of the two, and ensure that you don't
have path conflicts there.

Then if you wanted to use such a branch as a submodule you'd grab that
down like you would any other branch.


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

* Re: "mixed" or "merged" submodules
  2022-07-06  9:16 ` Ævar Arnfjörð Bjarmason
@ 2022-07-06 12:28   ` Sim Tov
  0 siblings, 0 replies; 3+ messages in thread
From: Sim Tov @ 2022-07-06 12:28 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: git

Thank you very much! Simple and elegant! A solution that is actually
better than the hypothetical mixed submodules... no overhead on
maintaining several repos...

On Wed, Jul 6, 2022 at 12:18 PM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
>
> On Tue, Jul 05 2022, Sim Tov wrote:
>
> > Hello,
> >
> > here  https://stackoverflow.com/q/72770397/1876484
> >
> > I asked this question:
> >
> > I'm aware of git submodules which dwell each in its own separate directory.
> >
> > 1. But is there such thing as "mixed" submodules whose content is
> > "merged" together?
> >
> > For instance:
> >
> > - Submodule1 (path ./), consist of files `a.txt`, `b.txt` and
> > directory `C` with the file `1.txt`
> > - Submodule2 (path ./), consist of files `x.txt`, `y.txt` and
> > directory `C` with the file `2.txt`
> > - Resulting "mixed" repo of both submodules: files `a.txt`, `b.txt`,
> > `x.txt`, `y.txt` and directory `C` with the files `1.txt`, `2.txt`
> >
> > 2. If it is not implemented in git - is there a workaround to achieve this?
> >
> > Here my use case:
> >
> > Both submodules - independent libraries (collection of books as plain
> > text files), which have same structure (directories = book
> > categories). I want to present the combined parent git repository as
> > full collection of books, while both projects evolve independently and
> > do not overlap (in terms of file names = books).
> >
> > I got a very detailed and informative answer. My question now - do you
> > see any other practical use cases for such a feature? Would such a
> > more general case of submodules be a good feature in git or not?
>
> Good question, but to answer the thought experiment don't conflate
> submodules with this, instead suppose that you have two branches A & B,
> which have:
>
>     A: A.txt
>     B: B.txt
>
> How will you create and maintain a third branch C which has the union of
> the two?
>
> The answer to that question will be the same as with the submodule case,
> i.e. you'd need to have some third branch that you maintain (e.g. with a
> push hook?) that would be a merge of the two, and ensure that you don't
> have path conflicts there.
>
> Then if you wanted to use such a branch as a submodule you'd grab that
> down like you would any other branch.
>

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

end of thread, other threads:[~2022-07-06 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 20:35 "mixed" or "merged" submodules Sim Tov
2022-07-06  9:16 ` Ævar Arnfjörð Bjarmason
2022-07-06 12:28   ` Sim Tov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.