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

Re: [RFC PATCH] clone: add clone.recursesubmodules config option

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 4, 2014, 17:24 UTC
Message-ID
<xmqqvbsgvb9l.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1401874256-13332-1-git-send-email-judge.packham@gmail.com>
Chris Packham <judge.packham@gmail.com> writes:
Show 16 quoted lines
> On 04/06/14 09:05, Junio C Hamano wrote:
>>> Also, going --recursive when the user did not want is a lot more
>>> expensive mistake to fix than not being --recursive when the user
>>> wanted to.
>> 
>> Having said all that, I do not mean to say that I am opposed to
>> introduce some mechanism to let the users express their preference
>> between recursive and non-recursive better, so that "git clone"
>> without an explicit --recursive (or --no-recursive) can work to
>> their taste.  A configuration in $HOME/.gitconfig might be a place
>> to start, even though that has the downside of assuming that the
>> given user would want to use the same settings for all his projects,
>> which may not be the case in practice.
>
> And here's a quick proof of concept. Not sure about the config variable name
> and it could probably do with a negative test as well.

I would be more worried about the semantics than the name, though; re-read the part you quoted with extra stress on "has the downside".

I think I heard the submodule folks (cc'ed) discuss an approach to allow various submodules to be marked with "tags" with a new type of entry in .gitmodules file in the superproject, and use these tags to signal "by default, a new clone will recurse into this submodule".

E.g. if projects standardized on "defaultClone" to mark such submodules, then $HOME/.gitconfig could say

    [clone]
        recursesubmodules = defaultClone

Or the projects may mark platform specific submodules with tags, e.g. a .gitmodules in a typical superproject might say something like this:

    [submodule "posix"]
    	path = ports/posix
        tags = linux obsd fbsd osx
    [submodule "windows"]
        path = ports/windows
        tags = win32
    [submodule "doc"]
    	path = documentation
        tags = defaultClone
and then the user's $HOME/.gitconfig might say
    [clone]
        recursesubmodules = defaultClone win32

to tell a "git clone" of such a superproject to clone the top-level, read its .gitmodules, and choose documentation/ and ports/windows submodules but not ports/posix submodule to be further cloned into the working tree of the superproject.

Of course, if this kind of project organization proves to be useful, we should try to standardize the set of tags early before people start coming up with random variations of the same thing, spelling the same concept in different ways only to be different, and if that happens, then we could even give a non-empty default value for the clone.recursesubmodules when $HOME/.gitconfig is missing one.

Just a random thought.
Previous: Chris PackhamNext: Jens Lehmann
Message 6 of 21 in “Paper cut bug: Why isn't "git clone xxxx" recursive by default?”
  1. Mara KimJun 3, 2014
  2. Junio C HamanoJun 3, 2014
  3. Junio C HamanoJun 3, 2014
  4. Mara KimJun 3, 2014
  5. clone: add clone.recursesubmodules config optionChris Packham, Jun 4, 2014
  6. Junio C HamanoJun 4, 2014
  7. Jens LehmannJun 4, 2014
  8. Junio C HamanoJun 5, 2014
  9. W. Trevor KingJun 5, 2014
  10. Heiko VoigtJun 6, 2014
  11. Jeremy MortonAug 2, 2017
  12. Stefan BellerAug 2, 2017
  13. Heiko VoigtJun 4, 2014
  14. Chris PackhamJun 5, 2014
  15. Heiko VoigtJun 6, 2014
  16. Junio C HamanoJun 6, 2014
  17. Jens LehmannJun 9, 2014
  18. W. Trevor KingJun 9, 2014
  19. Jeremy MortonOct 3, 2016
  20. Stefan BellerOct 3, 2016
  21. Heiko VoigtOct 4, 2016

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.