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

Re: Problem with --shallow-submodules option

From
IZIstvan Zakar <istvan.zakar@gmail.com>
Date
Jun 30, 2016, 13:27 UTC
Message-ID
<CAPV8XuZ4wTWBPkwB4grmx-oznnx2koiCFvVLZ-oG+E2v1ipPBw@mail.gmail.com>
In-Reply-To
<20160622153145.GB16644@paksenarrion.iveqy.com>
Hello,

Thanks for your answers. I tested it after the changes were made on the git server, and it seems to be working. But some other issue came up.

We have quite many submodules in our project so I did some comaprision:

If I do a clone with these parameters: --jobs 20 --recurse-submodules

The clone lasts ~53 seconds, and the total size of the folder is around 2 GB.

If I add the shallow-submodules option, the size of the folder will be a bit below 1GB, so the size decreased as I expected, but the time of the clone itself increased to 90 seconds. It seems the last step of the command, checking out the submodules is executed one-by-one, and not in parallel, so it seems at this step the jobs parameter does not have effect.

Is it intentional, or there is some option I missed?
I'm using git 2.9.0 on client side.
Thanks,
   Istvan

ps: if I update the submodules with --depth 1 parameter in parallel using xargs it lasts about 18 seconds, so it's a workaround for this issue, but it would be nice to do it with a single command.

On 22 June 2016 at 17:31, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
Show 29 quoted lines
> On Mon, Jun 20, 2016 at 01:06:39PM +0000, Istvan Zakar wrote:
>> I'm working on a relatively big project with many submodules. During
>> cloning for testing I tried to decrease the amount of data need to be
>> fetched from the server by using --shallow-submodules option in the clone
>> command. It seems to check out the tip of the remote repo, and if it's not
>> the commit registered in the superproject the submodule update fails
>> (obviously). Can I somehow tell to fetch that exact commit I need for my
>> superproject?
>
> Maybe. http://stackoverflow.com/questions/2144406/git-shallow-submodules
> gives a good overview of this problem.
>
> git fetches a branch and is shallow from that branch, which might be an
> other sha1 than the one the submodule points to, (as you say). This
> is/was one of the drawbacks with this method. However the since git 2.8,
> git will try to fetch the sha1 direct (and not the branch). So then it
> will work, if(!), the server supports direct access to sha1. This was
> previously not allowed due to security concerns (if I recall correctly).
>
> So the answer is, yes this will work if you've a recent version of git
> and support on the server side for doing this. Unfortunately I'm not
> sure which git version is needed on the server side for this to work.
>
> --
> Fredrik Gustafsson
>
> phone: +46 733-608274
> e-mail: iveqy@iveqy.com
> website: http://www.iveqy.com
Previous: Fredrik GustafssonNext: Stefan Beller
Message 6 of 8 in “Problem with --shallow-submodules option”
  1. Istvan ZakarJun 20, 2016
  2. Stefan BellerJun 20, 2016
  3. Istvan ZakarJun 21, 2016
  4. Stefan BellerJun 21, 2016
  5. Fredrik GustafssonJun 22, 2016
  6. Istvan ZakarJun 30, 2016
  7. Stefan BellerJun 30, 2016
  8. Istvan ZakarJun 30, 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.