@matheusbsbs / matheus-bagliano / commits / 460ed0d4b4
Fork 0

upload-pack: pass upload_pack_data to got_oid()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to got_oid(), 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 <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Jun 11, 2020 at 14:05 UTC 460ed0d4b4b460ee721304a90a65f7bf2981dbe1
1 file changed +4 -4
upload-pack.c
+4 -4
@@ -393,8 +393,8 @@ static void create_pack_file(struct upload_pack_data *pack_data)
393 die("git upload-pack: %s", abort_msg);
394 }
395
396 -static int got_oid(const char *hex, struct object_id *oid,
397 - struct object_array *have_obj)
396 +static int got_oid(struct upload_pack_data *data,
397 + const char *hex, struct object_id *oid)
398 {
399 struct object *o;
400 int we_knew_they_have = 0;
@@ -422,7 +422,7 @@ static int got_oid(const char *hex, struct object_id *oid,
422 parents->item->object.flags |= THEY_HAVE;
423 }
424 if (!we_knew_they_have) {
425 - add_object_array(o, NULL, have_obj);
425 + add_object_array(o, NULL, &data->have_obj);
426 return 1;
427 }
428 return 0;
@@ -478,7 +478,7 @@ static int get_common_commits(struct upload_pack_data *data,
478 continue;
479 }
480 if (skip_prefix(reader->line, "have ", &arg)) {
481 - switch (got_oid(arg, &oid, &data->have_obj)) {
481 + switch (got_oid(data, arg, &oid)) {
482 case -1: /* they have what we do not */
483 got_other = 1;
484 if (data->multi_ack