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

Re: git fetch sha1

From
Shawn Pearce <spearce@spearce.org>
Date
Jul 4, 2014, 20:41 UTC
Message-ID
<CAJo=hJvjg0G+DiRhyh=9jnRTPjWma7zQv90VsW8Bx1WyvsQTLg@mail.gmail.com>
In-Reply-To
<CABo2x6A_cA8KoFbe4Hcg0SJw+gOGeOFun3VDM1gx3ZVWK8wy3Q@mail.gmail.com>
On Fri, Jul 4, 2014 at 10:51 AM, Allan Gardner <allanegardner@gmail.com> wrote:
Show 31 quoted lines
> Currently fetching a sha1 fails on git.kernel.org:
>
> $ git --version && uname -a
> git version 1.9.4
> Linux nixos 3.12.23 #1-NixOS SMP Thu Jan 1 00:00:01 UTC 1970 x86_64 GNU/Linux
>
> $ rm -rf test && mkdir test && cd test && git init
> Initialized empty Git repository in ~/test/.git/
>
> $ git fetch --depth 1 https://git.kernel.org/pub/scm/git/git.git
> 782735203c316041df120748e5e88c1787cdf4da
> error: no such remote ref 782735203c316041df120748e5e88c1787cdf4da
>
> I tried with head, same error. However, if I clone the full repository
> and then manually execute git upload-pack, it successfully fetches the
> commit:
>
> $ git fetch https://git.kernel.org/pub/scm/git/git.git master
> <wait an hour>
> $ git checkout -b sha1 782735203c316041df120748e5e88c1787cdf4da
> $ printf "0045want %s multi_ack_detailed\n000Ddeepen
> 1\n00000009done\n0000" "782735203c316041df120748e5e88c1787cdf4da"
>>input
> $ cat input | git upload-pack --stateless-rpc . > output
> $ sed -z "s/.*0008NAK\n//" < output > output.pack
> $ git index-pack output.pack && git verify-pack -v output.pack | grep commit
> f239687a5dbbd1bbb761d09edec582418c66c297
> 782735203c316041df120748e5e88c1787cdf4da commit 374 234 12
>
> So theoretically this is supported server-side. Unfortunately
> kernel.org does not agree:

No, it is not supported server side. Your test didn't even test what you think it tested.

$ curl https://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack 2>/dev/null | head -n 2 001e# service=git-upload-pack 0000009b6f92e5ff3cdc813de8ef5327fd4bad492fb7d6c9 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed

The capability you are asking about is allow-tip-sha1-in-want which does not appear in the server advertisement. So its not supported on this server.

Previous: Allan GardnerNext: Shawn Pearce
Message 2 of 3 in “git fetch sha1”
  1. Allan GardnerJul 4, 2014
  2. Shawn PearceJul 4, 2014
  3. Shawn PearceJul 5, 2014

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.