git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Zsolt Imre <imrexzsolt@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: Git Push Always uses Protocol Version 0
Date: Mon, 22 Jan 2024 17:04:40 -0500	[thread overview]
Message-ID: <20240122220440.GB811766@coredump.intra.peff.net> (raw)
In-Reply-To: <E121C312-5771-47EF-9099-BEC8EFC2B9BD@gmail.com>

On Mon, Jan 22, 2024 at 07:24:53PM +0000, Zsolt Imre wrote:

> And to answer your question of what I cannot do with the "current
> versions" of the protocol: I could do everything, of course. But, if
> there's protocol 0, 1 and 2 and I wanted to implement only version 2,
> I thought I should be able to. If protocol V2 was complete, I would
> not have to worry about implementing V0 and V1 (saving some time and
> headache), especially because I do not care about supporting old
> clients. I may have misunderstood the word "version" and version 2 is
> more of an "extension" to V1?

I think the main confusion is that there simply isn't a "v2" push
protocol. It has not yet been written.

There was discussion when v2 was being worked on there that might be a
single "git serve" endpoint that would handle both fetch and push. But
in practice the backwards-compatibility technique we use requires asking
for the usual "upload-pack" or "receive-pack". And hence there isn't
really a single protocol, but still a fetch protocol which can be v0 or
v2, and a push protocol which is always v0.

It's possible we'd shift direction there, but IMHO there's value in
having separate per-operation endpoints. There's some more discussion
in this sub-thread:

  https://lore.kernel.org/git/20181213195305.249059-1-jonathantanmy@google.com/

Now of course a v2 push protocol, if it is ever written, will probably
look a lot like the v2 fetch protocol, and they can probably share a lot
of the implementation. But v0 and v2 are not that different either. In a
hypothetical world where v2 push existed and you could get away with
skipping v0 push entirely, I'd expect that "v2 push and v2 fetch" would
be about the same amount of work as the current "v0 push and v2 fetch".

-Peff

PS I saw some mention of "v1" in this thread; I wasn't sure if this was
   meant to refer to "v0" (a mistake I have made lots of times myself).
   But if not, "v1" is not really of any interest. It was a brief
   experimental phase for the client-upgrade mechanisms, and it behaves
   exactly like v0. No version of Git has ever used it by default.

      reply	other threads:[~2024-01-22 22:04 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
2024-01-22 19:24   ` Zsolt Imre
2024-01-22 22:04     ` Jeff King [this message]

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=20240122220440.GB811766@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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).