git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Grigory Yakushev <gy@daedalean.ai>
Cc: git@vger.kernel.org
Subject: Re: Failure to fetch submodule with --depth=1 parameter
Date: Tue, 3 Sep 2019 23:14:26 -0400	[thread overview]
Message-ID: <20190904031426.GC28836@sigill.intra.peff.net> (raw)
In-Reply-To: <CACfeHrrajM8_p0=N8ZPm9h7ObcvWT5EnVa-gLhtDODdG9GeyBw@mail.gmail.com>

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

  reply	other threads:[~2019-09-04  3:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 15:30 Failure to fetch submodule with --depth=1 parameter Grigory Yakushev
2019-09-04  3:14 ` Jeff King [this message]
2019-09-05 14:53   ` Grigory Yakushev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190904031426.GC28836@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gy@daedalean.ai \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).