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

Re: Shallow submodule efficiency

From
Stefan Beller <sbeller@google.com>
Date
Jun 28, 2016, 19:56 UTC
Message-ID
<CAGZ79kastJyauxh25Re3daQGFAxEC1dQ1bWkaSgzOgHmbY-_FQ@mail.gmail.com>
In-Reply-To
<2808201e-130a-55a4-a4ee-70f4d2f428f6@gmx.net>

On Tue, Jun 28, 2016 at 12:08 PM, Martin von Gagern <Martin.vGagern@gmx.net> wrote:

Show 26 quoted lines
> Hi Stefan,
>
> On 28.06.2016 19:20, Stefan Beller wrote:
>>> I have the feeling that “git submodule update --depth 1” is less clever
>>> than it could be. Here is one example I observed with git 2.0.0:
>>
>> 2.9.0 (as "Direct fetching of " is not part of 2.0.0 IIRC) ?
>
> Yes, sorry. I had this tested with 2.8.3 at first, then waited for my
> update to 2.9.0 to reproduce, and garbled the text while adjusting it.
>
>> Makes sense! I think the easiest way forward to implement this will be:
>>
>> * `git clone` learns a (maybe undocumented internal) option `--get-sha1`
>>   `--branch` looks similar to what we want, but doesn't quite fit as we do not
>>   know, whether we're on a tag or not. The submodule tells us just the
>>   recorded sha1, not the branch/tag. So maybe we'd end up calling it
>>   `--detach-at=<sha1>`,
>
> That name makes a lot of sense to me.
>
>>   that will
>>   -> inspect the ls-remote for the sha1 being there
>>   -> if the sha1 is there (at least once) clone as if --branch <tag> was given
>
> Clone but detach, to be consistent. Yes.
Oh, right.
Show 5 quoted lines
>
>>   -> if not found and the server advertised  allowReachableSHA1InWant,
>> try again inside the clone
>
> All of this has to pass through transport and get-pack, right?

Yeah we have to go through the transport layer, i.e. from builtin/clone.c we manipulate the transport object as defined in transport.h and code in transport.c What do you mean by get-pack, though?

Show 11 quoted lines
>
>> * `submodule--helper update-clone` passes the  `--get-sha1` to the
>> clones of the submodules
>>
>> * cmd_update() in git-submodule.sh will only checkout submodules and
>> not try again
>>   to fetch them if `just_cloned` is set as the cloning did the best it could.
>
> Sounds like a very reasonable roadmap to me.
>
> Do you think there will be someone volunteering to tackle this?

I have it on my (low priority) TODO list, so if you want it sooner than later, go for it yourself. Otherwise just wait. Maybe Duy has some interest as well.

Thanks, Stefan

>
> Greetings,
>   Martin
Previous: Martin von Gagern
Message 4 of 4 in “Shallow submodule efficiency”
  1. Martin von GagernJun 28, 2016
  2. Stefan BellerJun 28, 2016
  3. Martin von GagernJun 28, 2016
  4. Stefan BellerJun 28, 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.