{"thread":{"id":"52797","subject":"recursive cloning with --reference-if-able + --dissociate","startedAt":"2020-02-13T14:45:20Z","lastAt":"2020-02-13T16:18:43Z","messageCount":2,"participants":["Rasmus Villemoes","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"391664","messageId":"83602548-c0a6-db37-ccdf-5c0f4b233b2e@rasmusvillemoes.dk","threadId":"52797","inReplyTo":null,"subject":"recursive cloning with --reference-if-able + --dissociate","fromName":"Rasmus Villemoes","fromEmail":"rv@rasmusvillemoes.dk","sentAt":"2020-02-13T14:45:14Z","receivedAt":"2020-02-13T14:45:20Z","isPatch":false,"sender":{"key":"rv@rasmusvillemoes.dk","avatar":"https://avatars.githubusercontent.com/u/4375908?v=4"},"body":"At $dayjob, most of our projects are organized as a rather small\nsuperproject, with a number of git submodules. Usually, one of those\nsubmodules is a linux kernel git tree.\n\nFor CI testing, we create a fresh docker container which starts by doing\na \"git clone --recursive $superproject\", which takes quite a while due\nto the linux repo. So we'd like to speed that up by having a reasonable\nup-to-date linux repo on each build slave, mapping that into the docker\ncontainer, and then telling git \"when you get to cloning the src/linux\nsubmodule, look over here for objects\", i.e. having some way to have\n--reference-if-able and --disassociate in effect for submodules.\n\nIf this is already possible, I can't find it in the documentation. And\nif it doesn't exist, I can't really think of a good way to define the UI\nfor giving those options (other than, perhaps, having a top-level\n--reference-if-able pass down to the submodules with the meaning 'when\ninitializing the submodule at some/path, try to use the submodule, if\nany, at some/path in the referenced top-level repo'\".\n\nRasmus\n"},{"id":"391669","messageId":"xmqqv9oasboh.fsf@gitster-ct.c.googlers.com","threadId":"52797","inReplyTo":"83602548-c0a6-db37-ccdf-5c0f4b233b2e@rasmusvillemoes.dk","subject":"Re: recursive cloning with --reference-if-able + --dissociate","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-02-13T16:18:38Z","receivedAt":"2020-02-13T16:18:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rasmus Villemoes <rv@rasmusvillemoes.dk> writes:\n\n> At $dayjob, most of our projects are organized as a rather small\n> superproject, with a number of git submodules. Usually, one of those\n> submodules is a linux kernel git tree.\n>\n> For CI testing, we create a fresh docker container which starts by doing\n> a \"git clone --recursive $superproject\", which takes quite a while due\n> to the linux repo. So we'd like to speed that up by having a reasonable\n> up-to-date linux repo on each build slave, mapping that into the docker\n> container, and then telling git \"when you get to cloning the src/linux\n> submodule, look over here for objects\", i.e. having some way to have\n> --reference-if-able and --disassociate in effect for submodules.\n>\n> If this is already possible, I can't find it in the documentation. And\n> if it doesn't exist, I can't really think of a good way to define the UI\n> for giving those options (other than, perhaps, having a top-level\n> --reference-if-able pass down to the submodules with the meaning 'when\n> initializing the submodule at some/path, try to use the submodule, if\n> any, at some/path in the referenced top-level repo'\".\n\nSorry for not giving a full solution but I suspect that discussing\nthis topic will lead to a useful new feature, similar in spirit to\nthe url rewriting (i.e. \"url.$LOCAL.insteadOf = $REMOTE\") to tell\nGit to use a local mirror $LOCAL instead of the remote authentic\nrepository when interacting with $REMOTE.\n\nPerhaps \"url.$LOCALREF.autoReference = $REMOTE\" to specify a local\nmirror that does not have to be completely up-to-date, that will\naltomatically be used as if \"--reference-if-able $LOCALREF\" is\npassed when running \"git clone $REMOTE\", or something like that.\n\nThe actual design has to get a lot more involved, including\ndeciding:\n\n - if autoReference is orthogonal to --disssociate (I think it\n   should be but others may differ).\n\n - how the way --dissociate is passed down from the top-level\n   superproject to cloning of submodules is controlled (passing\n   unconditionally would probably be too coarse, but I dunno).\n\netc. etc.\n"}]}