Skip to content

Commit

Permalink
upload-pack: pass upload_pack_data to receive_needs()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
chriscool authored and gitster committed May 18, 2020
1 parent 0797769 commit d92ae2c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,8 @@ static int process_deepen_not(const char *line, struct string_list *deepen_not,
return 0;
}

static void receive_needs(struct packet_reader *reader,
struct object_array *want_obj,
struct list_objects_filter_options *filter_options)
static void receive_needs(struct upload_pack_data *data,
struct packet_reader *reader)
{
struct object_array shallows = OBJECT_ARRAY_INIT;
struct string_list deepen_not = STRING_LIST_INIT_DUP;
Expand Down Expand Up @@ -944,8 +943,8 @@ static void receive_needs(struct packet_reader *reader,
if (skip_prefix(reader->line, "filter ", &arg)) {
if (!filter_capability_requested)
die("git upload-pack: filtering capability not negotiated");
list_objects_filter_die_if_populated(filter_options);
parse_list_objects_filter(filter_options, arg);
list_objects_filter_die_if_populated(&data->filter_options);
parse_list_objects_filter(&data->filter_options, arg);
continue;
}

Expand Down Expand Up @@ -990,7 +989,7 @@ static void receive_needs(struct packet_reader *reader,
if (!((allow_unadvertised_object_request & ALLOW_ANY_SHA1) == ALLOW_ANY_SHA1
|| is_our_ref(o)))
has_non_tip = 1;
add_object_array(o, NULL, want_obj);
add_object_array(o, NULL, &data->want_obj);
}
}

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

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

if (send_shallow_list(&writer, depth, deepen_rev_list, deepen_since,
&deepen_not, deepen_relative, &shallows,
want_obj))
&data->want_obj))
packet_flush(1);
object_array_clear(&shallows);
}
Expand Down Expand Up @@ -1176,7 +1175,7 @@ void upload_pack(struct upload_pack_options *options)
PACKET_READ_CHOMP_NEWLINE |
PACKET_READ_DIE_ON_ERR_PACKET);

receive_needs(&reader, &data.want_obj, &data.filter_options);
receive_needs(&data, &reader);
if (data.want_obj.nr) {
get_common_commits(&data, &reader);
create_pack_file(&data.have_obj,
Expand Down

0 comments on commit d92ae2c

Please sign in to comment.