git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: "Carlsson, Magnus" <Magnus.Carlsson@arris.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Fetching commit instead of ref
Date: Mon, 18 Dec 2017 10:22:15 -0800
Message-ID: <CAGZ79kaePjuN3fEOAj=0-qn=_3B_3AQXDMnNPPEbNLOVSWS0mQ@mail.gmail.com> (raw)
In-Reply-To: <1513600223353.28799@arris.com>

On Mon, Dec 18, 2017 at 4:30 AM, Carlsson, Magnus
<Magnus.Carlsson@arris.com> wrote:
> Hi
>
> I am involved in the git-subrepo project (https://github.com/ingydotnet/git-subrepo/). It's an attempt to simplify the inclusion of repos into other repos.
>
> In a certain situation I would really need to fetch all commits related to a specific commit (SHA). I have read the git fetch documentation and found nothing regarding this. It only seems to support fetching references.
>
> I found some traces on stack overflow:
> https://stackoverflow.com/questions/14872486/retrieve-specific-commit-from-a-remote-git-repository
>
> Following that recommendation it feels like it almost works:
> $ git fetch subrepo 50f730db793e0733b159326c5a3e78fd48cedfec:refs/remote/subrepo/foo-commit
> remote: Counting objects: 2311, done.
> remote: Total 2311 (delta 0), reused 0 (delta 0), pack-reused 2311
> Receiving objects: 100% (2311/2311), 703.64 KiB | 0 bytes/s, done.
> Resolving deltas: 100% (1174/1174), done.
> ----> So far so good, but then an error message appear:
> error: Server does not allow request for unadvertised object 50f730db793e0733b159326c5a3e78fd48cedfec
> ----> And nothing seems to be fetched.
>
> Is there a way to fetch a commit and any ancestors to that commit based on a SHA?

Ask the server operator to configure the server to allow fetching commits,
specifically "git config uploadpack.allowReachableSHA1InWant 1"


>
> Why do I need this?
> In git-subrepo we try to recreate another repo within our main repo. Creating the necessary parent references when they appear. In some cases we need to make sure that we have access to the correct commits from the subrepo, but we don't have any references except a SHA.

A very similar issue happens with submodules, which tries to fetch the
branch(es) first and then by SHA1 as a fallback, but this fallback may
fail as well due to the miss-configured server, at that point
submodules just error out.

  parent reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 12:30 Carlsson, Magnus
2017-12-18 18:16 ` Jonathan Tan
2017-12-18 18:22 ` Stefan Beller [this message]
2017-12-18 18:44 ` Junio C Hamano
2017-12-19  8:41   ` Carlsson, Magnus
2017-12-19 16:07     ` Junio C Hamano
2017-12-20  7:48       ` Carlsson, Magnus
2017-12-22 18:47         ` Junio C Hamano

Reply instructions:

You may reply publically 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='CAGZ79kaePjuN3fEOAj=0-qn=_3B_3AQXDMnNPPEbNLOVSWS0mQ@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=Magnus.Carlsson@arris.com \
    --cc=git@vger.kernel.org \
    /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

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox