Skip to content

Commit c67072b

Browse files
committed
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 <[email protected]>
1 parent b783aa7 commit c67072b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

send-pack.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,16 @@ int send_pack(struct send_pack_args *args,
304304

305305
old_hex = sha1_to_hex(ref->old_sha1);
306306
new_hex = sha1_to_hex(ref->new_sha1);
307-
if (!cmds_sent)
307+
if (!cmds_sent) {
308308
packet_buf_write(&req_buf,
309309
"%s %s %s%c%s",
310310
old_hex, new_hex, ref->name, 0,
311311
cap_buf.buf);
312-
else
312+
cmds_sent = 1;
313+
} else {
313314
packet_buf_write(&req_buf, "%s %s %s",
314315
old_hex, new_hex, ref->name);
315-
cmds_sent++;
316+
}
316317
}
317318

318319
if (args->stateless_rpc) {

0 commit comments

Comments
 (0)