@matheusbsbs / matheus-bagliano / commits / 329f996050
Fork 0

upload-pack: pass upload_pack_data to send_unshallow()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to send_unshallow(), so that this function can use all the fields of the struct. This will be used in followup commits to move static variables 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 329f9960505ba4af082614890bac205054701ede
1 file changed +7 -9
upload-pack.c
+7 -9
@@ -715,17 +715,15 @@ static void send_shallow(struct packet_writer *writer,
715 }
716 }
717
718 -static void send_unshallow(struct packet_writer *writer,
719 - const struct object_array *shallows,
720 - struct object_array *want_obj)
718 +static void send_unshallow(struct upload_pack_data *data)
719 {
720 int i;
721
724 - for (i = 0; i < shallows->nr; i++) {
725 - struct object *object = shallows->objects[i].item;
722 + for (i = 0; i < data->shallows.nr; i++) {
723 + struct object *object = data->shallows.objects[i].item;
724 if (object->flags & NOT_SHALLOW) {
725 struct commit_list *parents;
728 - packet_writer_write(writer, "unshallow %s",
726 + packet_writer_write(&data->writer, "unshallow %s",
727 oid_to_hex(&object->oid));
728 object->flags &= ~CLIENT_SHALLOW;
729 /*
@@ -741,7 +739,7 @@ static void send_unshallow(struct packet_writer *writer,
739 parents = ((struct commit *)object)->parents;
740 while (parents) {
741 add_object_array(&parents->item->object,
744 - NULL, want_obj);
742 + NULL, &data->want_obj);
743 parents = parents->next;
744 }
745 add_object_array(object, NULL, &extra_edge_obj);
@@ -789,7 +787,7 @@ static void deepen(struct upload_pack_data *data, int depth)
787 free_commit_list(result);
788 }
789
792 - send_unshallow(&data->writer, &data->shallows, &data->want_obj);
790 + send_unshallow(data);
791 }
792
793 static void deepen_by_rev_list(struct upload_pack_data *data,
@@ -802,7 +800,7 @@ static void deepen_by_rev_list(struct upload_pack_data *data,
800 result = get_shallow_commits_by_rev_list(ac, av, SHALLOW, NOT_SHALLOW);
801 send_shallow(&data->writer, result);
802 free_commit_list(result);
805 - send_unshallow(&data->writer, &data->shallows, &data->want_obj);
803 + send_unshallow(data);
804 }
805
806 /* Returns 1 if a shallow list is sent or 0 otherwise */