send-pack: clarify that cmds_sent is a boolean

We use it to make sure that the feature request is sent only once on the very first request packet (ignoring the "shallow " line, which was an unfortunate mistake we cannot retroactively fix with existing receive-pack already deployed in the field) and we set it to "true" with cmds_sent++, not because we care about the actual number of updates sent but because it is merely an idiomatic way. Set it explicitly to one to clarify that the code that uses this variable only cares about its zero-ness. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 19, 2014 at 13:02 UTC c67072b90bdc56501483e0ba96d0d833e86362c3
1 file changed +4 -3
send-pack.c
+4 -3
@@ -304,15 +304,16 @@ int send_pack(struct send_pack_args *args,
304
305 old_hex = sha1_to_hex(ref->old_sha1);
306 new_hex = sha1_to_hex(ref->new_sha1);
307 - if (!cmds_sent)
307 + if (!cmds_sent) {
308 packet_buf_write(&req_buf,
309 "%s %s %s%c%s",
310 old_hex, new_hex, ref->name, 0,
311 cap_buf.buf);
312 - else
312 + cmds_sent = 1;
313 + } else {
314 packet_buf_write(&req_buf, "%s %s %s",
315 old_hex, new_hex, ref->name);
315 - cmds_sent++;
316 + }
317 }
318
319 if (args->stateless_rpc) {