@matheusbsbs / matheus-bagliano / commits / b08c97423f
Fork 0

upload-pack: pass upload_pack_data to check_non_tip()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to check_non_tip(), so that this function and the functions it calls, can use all the fields of the struct in followup commits. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed May 15, 2020 at 12:04 UTC b08c97423fa3f55c1b40eb4b3604c4f990dd955b
1 file changed +6 -7
upload-pack.c
+6 -7
@@ -654,8 +654,7 @@ error:
654 return 1;
655 }
656
657 -static void check_non_tip(struct object_array *want_obj,
658 - struct packet_writer *writer)
657 +static void check_non_tip(struct upload_pack_data *data)
658 {
659 int i;
660
@@ -666,16 +665,16 @@ static void check_non_tip(struct object_array *want_obj,
665 */
666 if (!stateless_rpc && !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
667 goto error;
669 - if (!has_unreachable(want_obj))
668 + if (!has_unreachable(&data->want_obj))
669 /* All the non-tip ones are ancestors of what we advertised */
670 return;
671
672 error:
673 /* Pick one of them (we know there at least is one) */
675 - for (i = 0; i < want_obj->nr; i++) {
676 - struct object *o = want_obj->objects[i].item;
674 + for (i = 0; i < data->want_obj.nr; i++) {
675 + struct object *o = data->want_obj.objects[i].item;
676 if (!is_our_ref(o)) {
678 - packet_writer_error(writer,
677 + packet_writer_error(&data->writer,
678 "upload-pack: not our ref %s",
679 oid_to_hex(&o->oid));
680 die("git upload-pack: not our ref %s",
@@ -1003,7 +1002,7 @@ static void receive_needs(struct upload_pack_data *data,
1002 * by another process that handled the initial request.
1003 */
1004 if (has_non_tip)
1006 - check_non_tip(&data->want_obj, &data->writer);
1005 + check_non_tip(data);
1006
1007 if (!use_sideband && daemon_mode)
1008 no_progress = 1;