Skip to content

Commit 329f996

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 446e42c commit 329f996

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

upload-pack.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -715,17 +715,15 @@ static void send_shallow(struct packet_writer *writer,
715715
}
716716
}
717717

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)
721719
{
722720
int i;
723721

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;
726724
if (object->flags & NOT_SHALLOW) {
727725
struct commit_list *parents;
728-
packet_writer_write(writer, "unshallow %s",
726+
packet_writer_write(&data->writer, "unshallow %s",
729727
oid_to_hex(&object->oid));
730728
object->flags &= ~CLIENT_SHALLOW;
731729
/*
@@ -741,7 +739,7 @@ static void send_unshallow(struct packet_writer *writer,
741739
parents = ((struct commit *)object)->parents;
742740
while (parents) {
743741
add_object_array(&parents->item->object,
744-
NULL, want_obj);
742+
NULL, &data->want_obj);
745743
parents = parents->next;
746744
}
747745
add_object_array(object, NULL, &extra_edge_obj);
@@ -789,7 +787,7 @@ static void deepen(struct upload_pack_data *data, int depth)
789787
free_commit_list(result);
790788
}
791789

792-
send_unshallow(&data->writer, &data->shallows, &data->want_obj);
790+
send_unshallow(data);
793791
}
794792

795793
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,
802800
result = get_shallow_commits_by_rev_list(ac, av, SHALLOW, NOT_SHALLOW);
803801
send_shallow(&data->writer, result);
804802
free_commit_list(result);
805-
send_unshallow(&data->writer, &data->shallows, &data->want_obj);
803+
send_unshallow(data);
806804
}
807805

808806
/* Returns 1 if a shallow list is sent or 0 otherwise */

0 commit comments

Comments
 (0)