upload-pack: pass upload_pack_data to receive_needs()
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass 'struct upload_pack_data' to receive_needs(), so that this function and the functions it calls can use all the fields of that 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
d92ae2c0905c55f83830acec41ef7938200fa171
1 file changed
+8
-9
upload-pack.c
+8
-9
@@ -907,9 +907,8 @@ static int process_deepen_not(const char *line, struct string_list *deepen_not,
907
return 0;
908
}
909
910
-static void receive_needs(struct packet_reader *reader,
911
- struct object_array *want_obj,
912
- struct list_objects_filter_options *filter_options)
910
+static void receive_needs(struct upload_pack_data *data,
911
+ struct packet_reader *reader)
912
{
913
struct object_array shallows = OBJECT_ARRAY_INIT;
914
struct string_list deepen_not = STRING_LIST_INIT_DUP;
@@ -944,8 +943,8 @@ static void receive_needs(struct packet_reader *reader,
943
if (skip_prefix(reader->line, "filter ", &arg)) {
944
if (!filter_capability_requested)
945
die("git upload-pack: filtering capability not negotiated");
947
- list_objects_filter_die_if_populated(filter_options);
948
- parse_list_objects_filter(filter_options, arg);
946
+ list_objects_filter_die_if_populated(&data->filter_options);
947
+ parse_list_objects_filter(&data->filter_options, arg);
948
continue;
949
}
950
@@ -990,7 +989,7 @@ static void receive_needs(struct packet_reader *reader,
989
if (!((allow_unadvertised_object_request & ALLOW_ANY_SHA1) == ALLOW_ANY_SHA1
990
|| is_our_ref(o)))
991
has_non_tip = 1;
993
- add_object_array(o, NULL, want_obj);
992
+ add_object_array(o, NULL, &data->want_obj);
993
}
994
}
995
@@ -1002,7 +1001,7 @@ static void receive_needs(struct packet_reader *reader,
1001
* by another process that handled the initial request.
1002
*/
1003
if (has_non_tip)
1005
- check_non_tip(want_obj, &writer);
1004
+ check_non_tip(&data->want_obj, &writer);
1005
1006
if (!use_sideband && daemon_mode)
1007
no_progress = 1;
@@ -1012,7 +1011,7 @@ static void receive_needs(struct packet_reader *reader,
1011
1012
if (send_shallow_list(&writer, depth, deepen_rev_list, deepen_since,
1013
&deepen_not, deepen_relative, &shallows,
1015
- want_obj))
1014
+ &data->want_obj))
1015
packet_flush(1);
1016
object_array_clear(&shallows);
1017
}
@@ -1176,7 +1175,7 @@ void upload_pack(struct upload_pack_options *options)
1175
PACKET_READ_CHOMP_NEWLINE |
1176
PACKET_READ_DIE_ON_ERR_PACKET);
1177
1179
- receive_needs(&reader, &data.want_obj, &data.filter_options);
1178
+ receive_needs(&data, &reader);
1179
if (data.want_obj.nr) {
1180
get_common_commits(&data, &reader);
1181
create_pack_file(&data.have_obj,