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

Re: [RFC] multi_ack protocol v2

From
Sergey Vlasov <vsu@altlinux.ru>
Date
Oct 27, 2005, 10:16 UTC
Message-ID
<20051027141619.0e8029f2.vsu@altlinux.ru>
In-Reply-To
<7vzmov4elu.fsf@assigned-by-dhcp.cox.net>
On Thu, 27 Oct 2005 00:13:17 -0700 Junio C Hamano wrote:
[skip]
Show 24 quoted lines
> So let's illustrate the v2 the same way as I understand it.
> 
> upload-pack (S) | fetch/clone-pack (C) protocol (v2):
> 
> 	# Tell the puller what commits we have and what their names are
> 	S: SHA1 name
> 	S: ...
> 	S: SHA1 name
> 	S: # flush -- it's your turn
> 	# Tell the pusher what commits we want, and what we have.
>         # In addition, we tell the other end that we support protocol
> 	# extensions, without breaking the old servers.
> 	C: want SHA1 extended
> 	C: ..
> 	C: want SHA1
> 	C: # flush -- done with "want" lines.
> 
> Notice that until we hear from the server, we cannot tell if our
> "extended" protocol wish will be granted, and in the original
> protocol, "NAK" will come in fixed length, and the only thing we
> could tack arbitrary garbage to was "ACK SHA1".  That's why your
> "ACK SHA1 continue" works nicely, but at the time you could not
> find out if you are talking with updated server until you get at
> least one ACK.

Actually, there is another way to pass some data from the server which would be ignored by older clients - at the first stage, when upload-pack sends the list of refs to the client:

	packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname, '\0',
		     server_capabilities);

Old clients will ignore the additional data (functions which work with the received name will happily stop at the added NUL character; just some memory will be wasted), but the new implementation of get_remote_heads() could look for that NUL inside the received packet and find extended server capabilities after it. Then the client could just use new commands at the "want" stage.

Show 24 quoted lines
> However, at this point, we *could* force the server to reveal
> what it supports, by doing an extra flush here, before sending
> *ANY* "have" lines yet:
> 
> 	C: # flush -- this is another one after "I'm done with wants".
> 
> Upon receiving this, if we were talking with an old upload-pack,
> we would certanly get an NAK.  Note that the server already
> knows that we support extended protocol at this point, so our
> updated server can send anything here to say it knows what
> protocol extensions it supports.  Let's say it says something
> like this:
> 
> 	S: proto v2 v3 v5
> 
> to tell the puller it understands protocol v2, v3, and v5, to
> which the puller responds:
> 
> 	C: proto v2
> 
> After this exchange, both ends know they understand and would
> want to talk at protocol level v2.  This leaves door open for
> future protocol extension, but more importantly, I think this
> arrangement would make things safer.

This looks cleaner (no NUL bytes in the protocol), but does not allow to replace the "want" stage with something entirely different (if we ever want to do that).

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 4 of 10 in “[RFC] multi_ack protocol v2”
  1. Johannes SchindelinOct 27, 2005
  2. Junio C HamanoOct 27, 2005
  3. Johannes SchindelinOct 27, 2005
  4. Sergey VlasovOct 27, 2005
  5. Johannes SchindelinOct 27, 2005
  6. Junio C HamanoOct 27, 2005
  7. Johannes SchindelinOct 27, 2005
  8. Junio C HamanoOct 27, 2005
  9. Paul MackerrasOct 27, 2005
  10. Johannes SchindelinOct 27, 2005

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.