Skip to content

Commit 6fbbc43

Browse files
chriscoolgitster
authored andcommitted
upload-pack: pass upload_pack_data to send_acks()
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to send_acks(), so that this function can use all the fields of the struct. This will be used in followup commits to move a static variable into 'upload_pack_data'. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8dcf227 commit 6fbbc43

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

upload-pack.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,26 +1387,24 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common
13871387
return 0;
13881388
}
13891389

1390-
static int send_acks(struct packet_writer *writer, struct oid_array *acks,
1391-
const struct object_array *have_obj,
1392-
struct object_array *want_obj)
1390+
static int send_acks(struct upload_pack_data *data, struct oid_array *acks)
13931391
{
13941392
int i;
13951393

1396-
packet_writer_write(writer, "acknowledgments\n");
1394+
packet_writer_write(&data->writer, "acknowledgments\n");
13971395

13981396
/* Send Acks */
13991397
if (!acks->nr)
1400-
packet_writer_write(writer, "NAK\n");
1398+
packet_writer_write(&data->writer, "NAK\n");
14011399

14021400
for (i = 0; i < acks->nr; i++) {
1403-
packet_writer_write(writer, "ACK %s\n",
1401+
packet_writer_write(&data->writer, "ACK %s\n",
14041402
oid_to_hex(&acks->oid[i]));
14051403
}
14061404

1407-
if (ok_to_give_up(have_obj, want_obj)) {
1405+
if (ok_to_give_up(&data->have_obj, &data->want_obj)) {
14081406
/* Send Ready */
1409-
packet_writer_write(writer, "ready\n");
1407+
packet_writer_write(&data->writer, "ready\n");
14101408
return 1;
14111409
}
14121410

@@ -1421,8 +1419,7 @@ static int process_haves_and_send_acks(struct upload_pack_data *data)
14211419
process_haves(data, &common);
14221420
if (data->done) {
14231421
ret = 1;
1424-
} else if (send_acks(&data->writer, &common,
1425-
&data->have_obj, &data->want_obj)) {
1422+
} else if (send_acks(data, &common)) {
14261423
packet_writer_delim(&data->writer);
14271424
ret = 1;
14281425
} else {

0 commit comments

Comments
 (0)