Skip to content

Commit d92ae2c

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

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

upload-pack.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -907,9 +907,8 @@ static int process_deepen_not(const char *line, struct string_list *deepen_not,
907907
return 0;
908908
}
909909

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)
913912
{
914913
struct object_array shallows = OBJECT_ARRAY_INIT;
915914
struct string_list deepen_not = STRING_LIST_INIT_DUP;
@@ -944,8 +943,8 @@ static void receive_needs(struct packet_reader *reader,
944943
if (skip_prefix(reader->line, "filter ", &arg)) {
945944
if (!filter_capability_requested)
946945
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);
949948
continue;
950949
}
951950

@@ -990,7 +989,7 @@ static void receive_needs(struct packet_reader *reader,
990989
if (!((allow_unadvertised_object_request & ALLOW_ANY_SHA1) == ALLOW_ANY_SHA1
991990
|| is_our_ref(o)))
992991
has_non_tip = 1;
993-
add_object_array(o, NULL, want_obj);
992+
add_object_array(o, NULL, &data->want_obj);
994993
}
995994
}
996995

@@ -1002,7 +1001,7 @@ static void receive_needs(struct packet_reader *reader,
10021001
* by another process that handled the initial request.
10031002
*/
10041003
if (has_non_tip)
1005-
check_non_tip(want_obj, &writer);
1004+
check_non_tip(&data->want_obj, &writer);
10061005

10071006
if (!use_sideband && daemon_mode)
10081007
no_progress = 1;
@@ -1012,7 +1011,7 @@ static void receive_needs(struct packet_reader *reader,
10121011

10131012
if (send_shallow_list(&writer, depth, deepen_rev_list, deepen_since,
10141013
&deepen_not, deepen_relative, &shallows,
1015-
want_obj))
1014+
&data->want_obj))
10161015
packet_flush(1);
10171016
object_array_clear(&shallows);
10181017
}
@@ -1176,7 +1175,7 @@ void upload_pack(struct upload_pack_options *options)
11761175
PACKET_READ_CHOMP_NEWLINE |
11771176
PACKET_READ_DIE_ON_ERR_PACKET);
11781177

1179-
receive_needs(&reader, &data.want_obj, &data.filter_options);
1178+
receive_needs(&data, &reader);
11801179
if (data.want_obj.nr) {
11811180
get_common_commits(&data, &reader);
11821181
create_pack_file(&data.have_obj,

0 commit comments

Comments
 (0)