git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git fetch sha1
@ 2014-07-04 17:51 Allan Gardner
  2014-07-04 20:41 ` Shawn Pearce
  0 siblings, 1 reply; 3+ messages in thread
From: Allan Gardner @ 2014-07-04 17:51 UTC (permalink / raw
  To: git

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:

$ curl --data-binary @input --header "Content-Type:
application/x-git-upload-pack-request" --header "Accept-Encoding:
gzip" --header "Accept: application/x-git-upload-pack-result" --header
"Expect:" https://git.kernel.org/pub/scm/git/git.git/git-upload-pack >
output
$ wc -c output
0 output

Why is there a discrepancy between git.kernel.org and upload-pack
--stateless-rpc?

-- Allan Gardner

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git fetch sha1
  2014-07-04 17:51 git fetch sha1 Allan Gardner
@ 2014-07-04 20:41 ` Shawn Pearce
       [not found]   ` <CABo2x6CJz6PSFCDfn47cVQi44-J0oHsGqzSiyBe8Kt5NgWibog@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn Pearce @ 2014-07-04 20:41 UTC (permalink / raw
  To: Allan Gardner; +Cc: git

On Fri, Jul 4, 2014 at 10:51 AM, Allan Gardner <allanegardner@gmail.com> wrote:
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git fetch sha1
       [not found]   ` <CABo2x6CJz6PSFCDfn47cVQi44-J0oHsGqzSiyBe8Kt5NgWibog@mail.gmail.com>
@ 2014-07-05 16:30     ` Shawn Pearce
  0 siblings, 0 replies; 3+ messages in thread
From: Shawn Pearce @ 2014-07-05 16:30 UTC (permalink / raw
  To: Allan Gardner, git

On Sat, Jul 5, 2014 at 6:05 AM, Allan Gardner <allanegardner@gmail.com> wrote:
> On Fri, Jul 4, 2014 at 10:41 PM, Shawn Pearce <spearce@spearce.org> wrote:
>>
>> On Fri, Jul 4, 2014 at 10:51 AM, Allan Gardner <allanegardner@gmail.com> wrote:
>> > 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.
>
> $ git upload-pack --advertise-refs --stateless-rpc .
> 00d16f92e5ff3cdc813de8ef5327fd4bad492fb7d6c9 HEADmulti_ack thin-pack
> side-band side-band-64k ofs-delta shallow no-progress include-tag
> multi_ack_detailed no-done symref=HEAD:refs/heads/master
> agent=git/1.9.4
>
> I did not ask about allow-tip-sha1-in-want,

I think you did. You asked about passing a random SHA-1 to `git
fetch`. The client will only send this SHA-1 to the server if an
advertised ref exactly matches or the server advertised
allow-tip-sha1-in-want. Otherwise, it errors out.

> and it is not enabled by
> default. It appears that the server must advertise no-done though,
> which indeed git.kernel.org does not.

no-done is unrelated to passing a SHA-1 on the fetch line. The two
concepts have nothing to do with each other. I seriously doubt anyone
piggybacked additional features onto no-done years after it was
introduced.

> So my next question is how
> git.kernel.org can set up the smart HTTP protocol without using
> --stateless-rpc; I guess I will have to ask them.

Haha!

Good luck with that. Current implementation requires --stateless-rpc
to run smart HTTP.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-05 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-04 17:51 git fetch sha1 Allan Gardner
2014-07-04 20:41 ` Shawn Pearce
     [not found]   ` <CABo2x6CJz6PSFCDfn47cVQi44-J0oHsGqzSiyBe8Kt5NgWibog@mail.gmail.com>
2014-07-05 16:30     ` Shawn Pearce

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).