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

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

From
Kevin Ballard <kevin@sb.org>
Date
Oct 6, 2010, 22:52 UTC
Message-ID
<FB03A7DB-67D2-4EAE-A0F0-2F3E3CEA9878@sb.org>
In-Reply-To
<4CAB8DDF.8080004@web.de>
On Oct 5, 2010, at 1:43 PM, Jens Lehmann wrote:
Show 11 quoted lines
>   Kevin reported the fetch time went up from 1.5s to 20s for him
>   because of the recursion. Kevin, could you please test the branch
>   "parallel-submodule-fetch" from my github repository:
> 
>      http://github.com/jlehmann/git-submod-enhancements.git
> 
>   It has these three patches based on next plus a preliminary
>   commit fetching submodules in parallel (but note that a limit
>   of 128 submodules is hardcoded and the output might be mixed
>   between the fetch threads, I'll fix that when you confirm the
>   performance benefit I expect).
The first `git fetch` still took 20 seconds, but that's because there was data to fetch from one of the deeply-nested submodules (data which, incidentally, I have zero reason to want to fetch). Subsequent fetches took 6.3 seconds. This is contrasted with 1.9s to run `git -c fetch.recursive=false fetch`.
On Oct 5, 2010, at 2:06 PM, Junio C Hamano wrote:
Show 10 quoted lines
>>   a) "git fetch --all"
>> 
>>      The user wanted to fetch new commits from all remotes. I think
>>      git should also fetch all submodules then, no matter if new
>>      commits from them are fetched in the superproject, as the user
>>      explicitly said he wants everything. Objections?
> 
> Why?  I do not see a "--submodules" option on that command line.  The only
> thing I asked is to grab all branches for the project I ran "git fetch"
> in.
I agree with Junio.
Show 33 quoted lines
>>   b) "git fetch [<repository>]"
>> 
>>      The user wants to fetch from the default [or a single repo]. I
>>      think all submodules should be fetched too, Kevin thinks this
>>      should happen only when it is necessary (at least for his 'H'
>>      repository). While I think fetching all submodules too is
>>      consistent with the fact that you get all branches in the
>>      superproject too, whether you need them or not, we can't seem
>>      to agree on this one (also see my proposal below).
> 
> The case with <repository> is a lot more questionable than the case of
> fetching implicitly from whereever you usually fetch from.  Imagine that
> you fork git.git, and create a separate project that has some nifty
> additions to support submodules better.  The additional part is naturally
> done as a submodule.  This jens.git repository becomes very popular and
> people clone from it.  Your users usually interact with your repository by
> saying "git fetch" or "git pull" without any explicit <repository>.  They,
> however, would want to fetch/pull from me from time to time to get updates
> that you haven't incorporated in jens.git repository. "git fetch junio" is
> run.  Why should such a "fetch" go to your repository and slurp the
> objects for the submodules?
> 
> Perhaps you would want some knobs like these?
> 
>        [remote "origin"]
>                fetch-submodules = all
>                fetch-submodules = changed
> 
>        [remote "junio"]
>                fetch-submodules = none
> 
> I dunno.  I've never been a fan of automatically recursing into submodules
> (iow, treating the nested structure as if there is no nesting), so...
I agree with this as well.
After thinking on it a bit, I think the best solution is to add a switch --submodules to fetch which will also fetch all submodules, but otherwise fetch will fetch no submodules. This will avoid the problem of detecting changed submodules, while still allowing users to explicitly request all submodules in case they're about to get on a plane flight. And of course we can use a config switch to turn --submodules on or off by default. We should also give some thought to automatically updating submodules when `git pull` is performed. I could imagine `git pull --submodules` effectively doing `git pull && git submodule update --init --recursive`, though this implies submodule updating behavior as part of merge, and it seems harder to justify that.
-Kevin Ballard
Previous: Junio C HamanoNext: Jonathan Nieder
Message 36 of 55 in “Teach fetch and pull to recursively fetch submodules too”
  1. 0/2 Teach fetch and pull to recursively fetch submodules tooJens Lehmann, Aug 29, 2010
  2. 1/2 fetch/pull: Recursively fetch populated submodulesJens Lehmann, Aug 29, 2010
  3. 2/2 Submodules: Add the new "fetch" config optionJens Lehmann, Aug 29, 2010
  4. Junio C HamanoAug 30, 2010
  5. 2/2 Submodules: Add the new "fetch" config option for fetch and pullJens Lehmann, Aug 30, 2010
  6. Ævar Arnfjörð BjarmasonAug 29, 2010
  7. Jens LehmannAug 29, 2010
  8. Junio C HamanoAug 30, 2010
  9. Jens LehmannAug 30, 2010
  10. Kevin BallardSep 15, 2010
  11. Kevin BallardSep 15, 2010
  12. fetch: Get submodule paths from index and not from .gitmodulesJens Lehmann, Sep 16, 2010
  13. Kevin BallardSep 16, 2010
  14. Jens LehmannSep 17, 2010
  15. Johannes SixtSep 17, 2010
  16. Jens LehmannSep 17, 2010
  17. Johannes SixtSep 17, 2010
  18. Jens LehmannSep 17, 2010
  19. Johannes SixtSep 17, 2010
  20. Kevin BallardSep 18, 2010
  21. 0/2 fix problems with recursive submodule fetchingJens Lehmann, Sep 18, 2010
  22. 1/2 fetch: Fix a bug swallowing the output of recursive submodule fetchingJens Lehmann, Sep 18, 2010
  23. 2/2 fetch: Get submodule paths from index and not from .gitmodulesJens Lehmann, Sep 18, 2010
  24. Kevin BallardSep 19, 2010
  25. Jens LehmannSep 19, 2010
  26. Kevin BallardSep 20, 2010
  27. 0/3 Teach fetch and pull to recursively fetch submodules tooJens Lehmann, Oct 5, 2010
  28. 1/3 fetch/pull: Recursively fetch populated submodulesJens Lehmann, Oct 5, 2010
  29. 2/3 Submodules: Add the new "fetch" config option for fetch and pullJens Lehmann, Oct 5, 2010
  30. Jon SeymourOct 7, 2010
  31. Jens LehmannOct 9, 2010
  32. Jonathan NiederOct 9, 2010
  33. Jens LehmannOct 9, 2010
  34. 3/3 Add the 'fetch.recursive' config settingJens Lehmann, Oct 5, 2010
  35. Junio C HamanoOct 5, 2010
  36. Kevin BallardOct 6, 2010
  37. Jonathan NiederOct 6, 2010
  38. Jens LehmannOct 9, 2010
  39. Jonathan NiederOct 9, 2010
  40. Jens LehmannOct 9, 2010
  41. Jonathan NiederOct 21, 2010
  42. Jens LehmannOct 21, 2010
  43. Jens LehmannOct 9, 2010
  44. Marc BranchaudOct 13, 2010
  45. Jens LehmannOct 13, 2010
  46. Kevin BallardOct 13, 2010
  47. Jens LehmannOct 13, 2010
  48. Kevin BallardOct 13, 2010
  49. Chris PackhamOct 14, 2010
  50. Jens LehmannOct 14, 2010
  51. Chris PackhamOct 14, 2010
  52. Marc BranchaudOct 13, 2010
  53. Kevin BallardOct 13, 2010
  54. Jens LehmannSep 15, 2010
  55. Kevin BallardSep 15, 2010

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.