Skip to content

Commit

Permalink
send-pack: fix capability-sending logic
Browse files Browse the repository at this point in the history
If we have capabilities to send to the server, we send the
regular "want" line followed by a NUL, then the
capabilities; otherwise, we do not even send the NUL.

However, when checking whether we want to send the "quiet"
capability, we check args->quiet, which is wrong. That flag
only tells us whether the client side wanted to be quiet,
not whether the server supports it (originally, in c207e34,
it meant both; however, that was later split into two flags
by 01fdc21).

We still check the right flag when actually printing
"quiet", so this could only have two effects:

  1. We might send the trailing NUL when we do not otherwise
     need to. In theory, an antique pre-capability
     implementation of git might choke on this (since the
     client is instructed never to respond with capabilities
     that the server has not first advertised).

  2. We might also want to send the quiet flag if the
     args->progress flag is false, but this code path would
     not trigger in that instance.

In practice, it almost certainly never matters. The
report-status capability dates back to 2005. Any real-world
server is going to advertise that, and we will always
respond with at least that capability.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Aug 10, 2012
1 parent ff5effd commit ca8e127
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/send-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ int send_pack(struct send_pack_args *args,
char *new_hex = sha1_to_hex(ref->new_sha1);
int quiet = quiet_supported && (args->quiet || !args->progress);

if (!cmds_sent && (status_report || use_sideband || args->quiet)) {
if (!cmds_sent && (status_report || use_sideband || quiet)) {
packet_buf_write(&req_buf,
"%s %s %s%c%s%s%s agent=%s",
old_hex, new_hex, ref->name, 0,
Expand Down

0 comments on commit ca8e127

Please sign in to comment.