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

Re: Submodule, subtree, or something else?

From
JRJānis Rukšāns <janis.ruksans@gmail.com>
Date
Aug 24, 2015, 17:12 UTC
Message-ID
<1440436358.32140.72.camel@gmail.com>
In-Reply-To
<CAK6hiNiBD+DUdNq0c2DY9LWg2PCgE56SpbBip8BNNmHTsEttuQ@mail.gmail.com>
On Sv, 2015-08-23 at 17:13 -0600, Cox, Michael wrote:
> You might want to take a look at how the Boost (boost.org) project
> uses submodules.  They use submodules for each library.  I know they
> use relative paths in their .gitmodules file to avoid the problem
> you're referring to regarding "git clone --recurse-submodules".

Thanks! I had a look at their setup, and they are using ../libx.git for submodules, which unfortunately breaks when cloning from another "working copy":

$ git clone --recursive file:///tmp/gittest/repo.a/main.git main.work Cloning into 'main.work'... <snip> Submodule 'liba' (file:///tmp/gittest/repo.a/liba.git) registered for path 'liba' Cloning into 'liba'... <snip> Submodule path 'liba': checked out '6a0ef37c03a7068328956dcb8a08bc39f280edfc'

$ git clone --recursive file://($pwd)/main.work main.home Cloning into 'main.home'... <snip> Submodule 'liba' (file:///tmp/gittest/work/liba.git) registered for path 'liba' Cloning into 'liba'... fatal: '/tmp/gittest/work/liba.git' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. Clone of 'file:///tmp/gittest/work/liba.git' into submodule path 'liba' failed

After some trial and error I managed to get what I wanted to achieve by using ./liba as the submodule URL (no .git suffix!), and creating a file named liba in /tmp/gittest/repo.a/main.git (ie. the bare "origin" repo) with a single line in it:

gitdir: ../liba.git
However, I'm not sure it is the right thing, or even advisable to do so.
Previous: Jānis Rukšāns
Message 6 of 6 in “Submodule, subtree, or something else?”
  1. Jānis RukšānsAug 21, 2015
  2. Stefan BellerAug 22, 2015
  3. Jānis RukšānsAug 23, 2015
  4. Stefan BellerAug 24, 2015
  5. Jānis RukšānsAug 24, 2015
  6. Jānis RukšānsAug 24, 2015

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.