From: Junio C Hamano <gitster@pobox.com>
To: Zsolt Imre <imrexzsolt@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Git Push Always uses Protocol Version 0
Date: Mon, 22 Jan 2024 10:52:48 -0800 [thread overview]
Message-ID: <xmqqa5oxurnj.fsf@gitster.g> (raw)
In-Reply-To: <FD545E92-18EF-44B5-A7D5-61ECADD880E6@gmail.com> (Zsolt Imre's message of "Mon, 22 Jan 2024 08:59:35 +0000")
Zsolt Imre <imrexzsolt@gmail.com> writes:
> I'm not entirely sure if this is a bug or I am missing something,
> but I thought I would share in the hope someone can help out. I'm
> playing around with Git and trying to implement a git server that
> communicates over HTTP and supports Git protocol version 2 *only*.
>
> When I `clone` a repository, the Git client (version 2.43.0),
> after fetching the capabilities using protocol version 2, it
> proceeds to fetch the refs, again, via protocol version 2 using
> the `ls-refs` command. However, when I try to `push` my changes
> to the repo, the Git client refuses to use protocol version 2 and
> tries to obtain the ref list using protocol version 0, even if I
> pass in the `-c protocol.version=2` command line argument.
Given that v0 and v1 in the push direction behave exactly the same,
and there has been no need to add features that were not supportable
in v1 in the push direction, it is not surprising to see this code
int cmd_send_pack(int argc, const char **argv, const char *prefix)
{
...
switch (discover_version(&reader)) {
case protocol_v2:
die("support for protocol v2 not implemented yet");
break;
in https://github.com/git/git/blob/master/builtin/send-pack.c#L282
and also
int cmd_receive_pack(int argc, const char **argv, const char *prefix)
{
...
switch (determine_protocol_version_server()) {
case protocol_v2:
/*
* push support for protocol v2 has not been implemented yet,
* so ignore the request to use v2 and fallback to using v0.
*/
break;
in https://github.com/git/git/blob/master/builtin/receive-pack.c#L2538
that tells the receiving end to demote "v2" request down to "v0",
and have the pushing end honor that choice.
What specifically did you want to gain by using protocol version 2
in the "push" direction that you cannot do with the current
versions?
next prev parent reply other threads:[~2024-01-22 18:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 8:59 Git Push Always uses Protocol Version 0 Zsolt Imre
2024-01-22 18:52 ` Junio C Hamano [this message]
2024-01-22 19:24 ` Zsolt Imre
2024-01-22 22:04 ` Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa5oxurnj.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=imrexzsolt@gmail.com \
/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.
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 NNTP newsgroup(s).