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

Re: Why are submodules not automatically handled by default or at least configurable to do so?

From
Chris Packham <judge.packham@gmail.com>
Date
Oct 26, 2015, 00:56 UTC
Message-ID
<CAFOYHZAKvN8xMKePCNFgo_ySHr0dc0+ASY0ux7j0p8UF1fuWCQ@mail.gmail.com>
In-Reply-To
<D4E5E890658.000004DCjohsmi9933@inbox.com>
On Mon, Oct 26, 2015 at 12:10 PM, John Smith <johsmi9933@inbox.com> wrote:
Show 9 quoted lines
> I found that I use submodules much, much more often in my git projects than I used externals
> in Subversion and the reason is that git encourages/forces to organize large projects into
> smaller repositories, one reason for this being that subversion allows to check out parts of
> a repository while git does not.
>
> But when I clone a git repository with subprojects, I (and everyone else) has to remember to
> add the --recursive option. When switching between branches with different versions/commits of the
> submodules everyone has to remember to update the submodules. When updating a submodule
> everyone has to remember to recurse there too.

The config option fetch.recurseSubmodules exists. It's not quite the same as what git clone --recurse-submodules does but it's a start.

Show 7 quoted lines
>
> Basically, everything with submodules has to be done manually every time and there seems
> to be no way to change that default.
>
> Why is that? Basically all the time I use submodules I would want automatic handling of
> submodules to happen and I cannot  remember having had a single situation where I would
> not have wanted it to happen. So  why does git default to doing nothing?

It's hard to pick a default that suits every workflow that submodules support. Also with submodules there is a chicken-and-egg scenario. While you can put things in ~/.gitconfig most of what you'd want to configure when using submodules would be in super/.git/config but that doesn't exist until you've cloned super.git.

> Why does it not provide a way to enable automatic
> pulling/updating of submodules e.g. when cloning or switching branches?

I believe Jens and Stefan (Cc'd) have been doing some great work in this area. Jens even posted his todo list a few days ago (https://github.com/jlehmann/git-submod-enhancements/wiki).

Show 17 quoted lines
> When would people routinely check out a branch and want to stay with the submodules as
> the have been checked out for the old branch?
>
> I honestly do not understand it.
>
> John
>
> ____________________________________________________________
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/manager
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: John SmithNext: Stefan Beller
Message 2 of 11 in “Why are submodules not automatically handled by default or at least configurable to do so?”
  1. John SmithOct 25, 2015
  2. Chris PackhamOct 26, 2015
  3. Stefan BellerOct 26, 2015
  4. Junio C HamanoOct 26, 2015
  5. Nazri RamliyOct 26, 2015
  6. Jens LehmannOct 26, 2015
  7. Nazri RamliyOct 28, 2015
  8. NickOct 27, 2015
  9. Davide FiorentinoOct 27, 2015
  10. NickOct 27, 2015
  11. Konstantin KhomoutovOct 27, 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.