do not send client agent unless server does first
commitd50c3871632451b0cac066eea178198ac8a9dff1
authorJeff King <peff@peff.net>
Fri, 10 Aug 2012 07:57:43 +0000 (10 03:57 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Aug 2012 19:35:13 +0000 (10 12:35 -0700)
treefd9ff70aeef269e251c193ca899cf6bb11f33352
parentca8e127c9bd65b07a565ca00aff8e0a48628bfc3
do not send client agent unless server does first

Commit ff5effdf taught both clients and servers of the git protocol
to send an "agent" capability that just advertises their version for
statistics and debugging purposes.  The protocol-capabilities.txt
document however indicates that the client's advertisement is
actually a response, and should never include capabilities not
mentioned in the server's advertisement.

Adding the unconditional advertisement in the server programs was
OK, then, but the clients broke the protocol.  The server
implementation of git-core itself does not care, but at least one
does: the Google Code git server (or any server using Dulwich), will
hang up with an internal error upon seeing an unknown capability.

Instead, each client must record whether we saw an agent string from
the server, and respond with its agent only if the server mentioned
it first.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch-pack.c
builtin/send-pack.c