Subject: Re: [PATCH v2 0/3] Teach fetch and pull to recursively fetch submodules too

From: Marc Branchaud <[email-masked]>
Date: Wed, 13 Oct 2010 17:27:16 -0400

On 10-10-13 03:34 PM, Kevin Ballard wrote:
> On Oct 13, 2010, at 12:32 PM, Jens Lehmann wrote:
> 
>>>> There are use cases like mine where automatic recursion is just the
>>>> right thing to do. But I would be fine with having to turn the
>>>> recursion on explicitly in the configuration if most people think
>>>> recursion is not a desirable default. It would be really nice to
>>>> hear from other submodule users what they think about that ...
>>> 
>>> I tend to think that the right default for fetch is to employ the same
>>> level of recursion that was used for the initial clone.  So if the
>>> clone was made with --recursive then fetch should default to using
>>> --recursive.
>> 
>> That's a very interesting idea.
> 
> I'm not sure it's correct though. For example, with my scenario every
> single submodule is required for a correct build, but most submodules
> should definitely not be updated unless their parent submodule updates its
> gitlink. So --recursive is recommended for `git clone`, but a
> non-recursive fetch would be the correct behavior going forward.

What about a "smart" recursive fetch?  One where if *any* new ref in the
superproject changes the superproject's submodule ref, *and* that submodule
ref isn't already in the submodule repo, then fetch updates the submodule.
Recurse as needed.

That way I don't think there'd be any missing commits when checking out
different branches in the superproject, and submodule fetches are minimized.

Not sure how easy that would be to implement though, or what the performance
would be like.

		M.