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

Re: Argument list too long when fetching many missing objects from partial clone

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Mar 1, 2021, 19:21 UTC
Message-ID
<be2a9647-3e3c-b88f-0f86-729dba5488c3@jeffhostetler.com>
In-Reply-To
<fd1ba192-b90c-ef20-0843-c0e47925c76a@gmail.com>
On 3/1/21 8:18 AM, Bagas Sanjaya wrote:
Show 25 quoted lines
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
> I'm poking around with partial clone. On my local server on my computer
> I have full clone of Git (git.git) repo.
> 
> I do partial clone from that server as remote (which is actually on the 
> same
> computer):
> 
>     git clone https://my-local-server.git/myself/git.git --filter=blob:none
> 
> Inside the partial clone, I tried to convert it to full clone. First, I 
> gather
> list of missing objects:
> 
>     git rev-list --objects --all --missing=print | grep -oP '^\?\K\w+' > 
> .git/missing.list
> 
> Then I fetched those:
> 
>     git fetch origin $(cat .git/missing.list)
> 

That command will build a very very long command line and cause the shell to complain. Instead, try passing the list of objects via stdin.

     $ cat .git/missing.list | git fetch --stdin origin
Show 41 quoted lines
> What did you expect to happen? (Expected behavior)
> 
> All missing objects fetched successfully
> 
> What happened instead? (Actual behavior)
> 
> Git returned:
> 
>      -bash: /opt/git/bin/git: Argument list too long
> 
> What's different between what you expected and what actually happened?
> 
> (nothing)
> 
> Anything else you want to add:
> 
> I think the problem lies on how to feed list of 110K+ objects to `git 
> fetch`.
> 
> Note: Both the local server and the computer use Git 2.30.1
> 
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
> 
> [System Info]
> git version:
> git version 2.30.1
> cpu: x86_64
> built from commit: 773e25afc41b1b6533fa9ae2cd825d0b4a697fad
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 5.10.11-kernelorg-upstream-generic #1 SMP Fri Jan 29 
> 12:56:19 WIB 2021 x86_64
> compiler info: gnuc: 9.3
> libc info: glibc: 2.31
> $SHELL (typically, interactive shell): /bin/bash
> 
> [Enabled Hooks]
> (none)
> 
Previous: Bagas SanjayaNext: Bryan Turner
Message 2 of 5 in “Argument list too long when fetching many missing objects from partial clone”
  1. Bagas SanjayaMar 1, 2021
  2. Jeff HostetlerMar 1, 2021
  3. Bryan TurnerMar 1, 2021
  4. Bagas SanjayaMar 2, 2021
  5. brian m. carlsonMar 3, 2021

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.