git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Nesting a submodule inside of another...

From
SRSeth Robertson <in-gitvger@baka.org>
Date
Jul 14, 2011, 14:33 UTC
Message-ID
<201107141433.p6EEXbb9023826@no.baka.org>
In-Reply-To
<CAEBDL5VUPE9YCX1C4pqkjb+EODkAWo9h774B=Jv5eUNbocMuZQ@mail.gmail.com>
In message <CAEBDL5VUPE9YCX1C4pqkjb+EODkAWo9h774B=Jv5eUNbocMuZQ@mail.gmail.com>, John Szakmeister writes:
    > I've got a project where we have several frameworks involved, and
    > external modules we want to pull into the framework tree.  We'd like
    > to make use of submodules and have something like this:
    >      top-level/<-- .gitmodules lives here
    >          src/
    >          framework1/<-- a submodule
    >              module/<-- another submodule
    >          framework2/<-- a submodule
    >              module2/<-- another submodule
    Again, I don't see how the submodule needs to be aware of the
    superproject.  In this case, it'd be the responsibility of the
    superproject to setup whatever is necessary at 'git submodule
    init/add'.  I don't see how the submodule *must* know about the
    superproject for it to succeed.  I see the opposite, the superproject
    needs to communicate some information down to the submodule, but I
    don't see the reverse.
    What I'm hearing is that while it may be possible, the idea of
    violating the concept that the "subrepo is standalone" is
    unacceptable.  Which means, unfortunately, git isn't a solution for us
    in this case.

You might find that gitslave (http://gitslave.sf.net) might be a better solution for you than git-submodules in this case. It works better for many workflows (and worse for others) but is much simpler to understand since with gitslave you have JBOR (just a bunch of repositories) with a program which can be thought of as running the requested git command over each repository in turn. Gitslave thus has a loose binding between the repositories, and you can only guarantee the relationship between repositories at tagged locations, though in practice this isn't a major concern.

gitslave supports nested repositories (and recursive gitslave repositories, but those are different). With gitslave nested repositories it is also true that you would have to have a supplemental gitignore entry in framework1 (which gitslave will create).

If you have any questions, please let me know.
					-Seth Robertson
Previous: John SzakmeisterNext: John Szakmeister
Message 9 of 11 in “Nesting a submodule inside of another...”
  1. John SzakmeisterJul 12, 2011
  2. Jens LehmannJul 12, 2011
  3. John SzakmeisterJul 13, 2011
  4. Jens LehmannJul 13, 2011
  5. Junio C HamanoJul 13, 2011
  6. Jens LehmannJul 13, 2011
  7. Junio C HamanoJul 13, 2011
  8. John SzakmeisterJul 14, 2011
  9. Seth RobertsonJul 14, 2011
  10. John SzakmeisterJul 15, 2011
  11. Andreas EricssonJul 13, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.