Skip to content

Commit 8dcf227

Browse files
chriscoolgitster
authored andcommitted
upload-pack: pass upload_pack_data to process_haves()
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to process_haves(), 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 629060d commit 8dcf227

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

upload-pack.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,14 +1348,13 @@ static void process_args(struct packet_reader *request,
13481348
die(_("expected flush after fetch arguments"));
13491349
}
13501350

1351-
static int process_haves(struct oid_array *haves, struct oid_array *common,
1352-
struct object_array *have_obj)
1351+
static int process_haves(struct upload_pack_data *data, struct oid_array *common)
13531352
{
13541353
int i;
13551354

13561355
/* Process haves */
1357-
for (i = 0; i < haves->nr; i++) {
1358-
const struct object_id *oid = &haves->oid[i];
1356+
for (i = 0; i < data->haves.nr; i++) {
1357+
const struct object_id *oid = &data->haves.oid[i];
13591358
struct object *o;
13601359
int we_knew_they_have = 0;
13611360

@@ -1382,7 +1381,7 @@ static int process_haves(struct oid_array *haves, struct oid_array *common,
13821381
parents->item->object.flags |= THEY_HAVE;
13831382
}
13841383
if (!we_knew_they_have)
1385-
add_object_array(o, NULL, have_obj);
1384+
add_object_array(o, NULL, &data->have_obj);
13861385
}
13871386

13881387
return 0;
@@ -1419,7 +1418,7 @@ static int process_haves_and_send_acks(struct upload_pack_data *data)
14191418
struct oid_array common = OID_ARRAY_INIT;
14201419
int ret = 0;
14211420

1422-
process_haves(&data->haves, &common, &data->have_obj);
1421+
process_haves(data, &common);
14231422
if (data->done) {
14241423
ret = 1;
14251424
} else if (send_acks(&data->writer, &common,

0 commit comments

Comments
 (0)