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

Re: [1.8.0] Recursively checkout, merge and reset populated submodules

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 22, 2011, 08:11 UTC
Message-ID
<4D636FAC.3000105@web.de>
In-Reply-To
<4D632029.7040501@cisco.com>
Am 22.02.2011 03:32, schrieb Phil Hord:
Show 13 quoted lines
> On 02/21/2011 07:51 PM, Miles Bader wrote:
>> Jens Lehmann <Jens.Lehmann@web.de> writes:
>>>>>> So, .gitmodules initially controls recursion.  When a submodule gets
>>>>>> populated, it gets an entry in .git/config which then determines the
>>>>>> recursion behavior from then on.  Changing branches might change .gitmodules,
>>>>>> but anything in .git/config will persist so any customizations the user makes
>>>>>> will also persist.
>>>>
>>>> Yes. Upstream can give sane defaults but the user has the last word.
>> If .git/config entries are created _automatically_ based on the initial
>> .gitmodules, doesn't that means it will cease to respect the upstream
>> defaults in the case where .gitmodules changes, even if the user didn't
>> actually change anything himself...?

Yes, unfortunately that is the current behavior of the git-submodule command, it copies the "update" entry into .git/config on init (but not on sync, so it is not updated then if it changed). The other submodule flags ("ignore" & "fetchRecurseSubmodules" don't show that behavior, the user has to copy them herself to override upstream settings). I'm in favor of removing that copy and using the setting from .gitmodules when "update" is not found in .git/config, but this changes behavior. But maybe that is a worthwhile change for 1.8.0 preparing for the things to come?

Show 5 quoted lines
> Also consider that the .gitmodules'  "upstream defaults" may have many
> changes
> within the existing repository.  So, $(git checkout foo) will load some
> "defaults" and
> $(git checkout bar) may load different "defaults".

Yes, and that is a feature. E.g. when you have a "working on foo" branch you can set the "fetchRecurseSubmodules" to "yes" there because you want to get all commits in the submodule to be able to commit some new ones in the superproject. But in every other branch setting that to "on-demand" will suffice.

>  I guess the defaults
> can be migrated
> into .git/config using $(git submodule init)...?

Not with "git submodule init", as they then would be set in stone from the beginning. But I can imagine a "git submodule config <setting>" helper program, which copies the setting into .git/config or updates it there when wanted.

Previous: Phil Hord
Message 14 of 14 in “[1.8.0] Summary of the discussions”
  1. Junio C HamanoFeb 18, 2011
  2. Martin von ZweigbergkFeb 18, 2011
  3. [1.7.5] Let fetch and pull recurse into submodules when new commits are recordedJens Lehmann, Feb 19, 2011
  4. Marc BranchaudFeb 21, 2011
  5. Jens LehmannFeb 21, 2011
  6. [1.8.0] Recursively checkout, merge and reset populated submodulesJens Lehmann, Feb 19, 2011
  7. Junio C HamanoFeb 20, 2011
  8. Marc BranchaudFeb 21, 2011
  9. Jens LehmannFeb 21, 2011
  10. Marc BranchaudFeb 21, 2011
  11. Jens LehmannFeb 21, 2011
  12. Miles BaderFeb 22, 2011
  13. Phil HordFeb 22, 2011
  14. Jens LehmannFeb 22, 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.