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

Re: recursive cloning with --reference-if-able + --dissociate

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 13, 2020, 16:18 UTC
Message-ID
<xmqqv9oasboh.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<83602548-c0a6-db37-ccdf-5c0f4b233b2e@rasmusvillemoes.dk>
Rasmus Villemoes <rv@rasmusvillemoes.dk> writes:
Show 18 quoted lines
> At $dayjob, most of our projects are organized as a rather small
> superproject, with a number of git submodules. Usually, one of those
> submodules is a linux kernel git tree.
>
> For CI testing, we create a fresh docker container which starts by doing
> a "git clone --recursive $superproject", which takes quite a while due
> to the linux repo. So we'd like to speed that up by having a reasonable
> up-to-date linux repo on each build slave, mapping that into the docker
> container, and then telling git "when you get to cloning the src/linux
> submodule, look over here for objects", i.e. having some way to have
> --reference-if-able and --disassociate in effect for submodules.
>
> If this is already possible, I can't find it in the documentation. And
> if it doesn't exist, I can't really think of a good way to define the UI
> for giving those options (other than, perhaps, having a top-level
> --reference-if-able pass down to the submodules with the meaning 'when
> initializing the submodule at some/path, try to use the submodule, if
> any, at some/path in the referenced top-level repo'".

Sorry for not giving a full solution but I suspect that discussing this topic will lead to a useful new feature, similar in spirit to the url rewriting (i.e. "url.$LOCAL.insteadOf = $REMOTE") to tell Git to use a local mirror $LOCAL instead of the remote authentic repository when interacting with $REMOTE.

Perhaps "url.$LOCALREF.autoReference = $REMOTE" to specify a local mirror that does not have to be completely up-to-date, that will altomatically be used as if "--reference-if-able $LOCALREF" is passed when running "git clone $REMOTE", or something like that.

The actual design has to get a lot more involved, including deciding:

 - if autoReference is orthogonal to --disssociate (I think it
   should be but others may differ).
 - how the way --dissociate is passed down from the top-level
   superproject to cloning of submodules is controlled (passing
   unconditionally would probably be too coarse, but I dunno).
etc. etc.
Previous: Rasmus Villemoes
Message 2 of 2 in “recursive cloning with --reference-if-able + --dissociate”
  1. Rasmus VillemoesFeb 13, 2020
  2. Junio C HamanoFeb 13, 2020

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.