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

Re: Failure to fetch submodule with --depth=1 parameter

From
GYGrigory Yakushev <gy@daedalean.ai>
Date
Sep 5, 2019, 14:53 UTC
Message-ID
<CACfeHrpfSJ8fEwqr66snRnc3pEk_jTrYHCRLtKFgaL9p4ZKthQ@mail.gmail.com>
In-Reply-To
<20190904031426.GC28836@sigill.intra.peff.net>
Thanks Jeff!
Completely solved the problem for me.
On Wed, Sep 4, 2019 at 5:14 AM Jeff King <peff@peff.net> wrote:
Show 44 quoted lines
>
> On Tue, Sep 03, 2019 at 05:30:02PM +0200, Grigory Yakushev wrote:
>
> > $ git --version
> > git version 2.17.1
> >
> > Repro:
> > $ git clone https://github.com/PX4/Firmware.git
> > $ cd Firmware
> > $ git submodule update --init --recursive --depth=1
> > ...
> > error: Server does not allow request for unadvertised object
> > 22df9475ca0d157e2db066a20f64c35906bf7f25
> > Fetched in submodule path 'Tools/sitl_gazebo', but it did not contain
> > 22df9475ca0d157e2db066a20f64c35906bf7f25. Direct fetching of that
> > commit failed.
> >
> > The same line without --depth=1 flag works fine:
> > $ git submodule update --init --recursive
>
> I think what's happening is this: the super-project (PX4/Firmware)
> points to a specific sha1 in the submodule (Tools/sitl_gazebo). But
> there's no branch pointing at that sha1, so the client cannot ask for it
> directly.
>
> As a fallback we instead fetch HEAD from the submodule and hope that we
> got the sha1 we needed. But because we pass along "--depth=1", that
> fallback is not likely to work.
>
> IMHO one obvious improvement on the client side is to have a third-level
> fallback to do a full clone, and hope we get it then.
>
> However, there may a be an easier solution. In the v2 protocol, Git does
> not enforce any advertisement or reachability properties for items the
> client asks for. So the client would be free to just ask for the sha1
> directly, no fallback required.
>
> Try setting:
>
>   git config --global protocol.version 2
>
> which seems to make it work.
>
> -Peff
Previous: Jeff King
Message 3 of 3 in “Failure to fetch submodule with --depth=1 parameter”
  1. Grigory YakushevSep 3, 2019
  2. Jeff KingSep 4, 2019
  3. Grigory YakushevSep 5, 2019

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.