@matheusbsbs / matheus-bagliano / commits / 59a902612a
Fork 0

upload-pack: move filter_capability_requested to upload_pack_data

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the filter_capability_requested static variable into this struct. It is only used by protocol v0 code since protocol v2 assumes certain baseline capabilities, but rolling it into upload_pack_data and just letting v2 code ignore it as it does now is more coherent and cleaner. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Jun 4, 2020 at 19:54 UTC 59a902612ab2cdea2a30882e90680a1e7618f823
1 file changed +3 -3
upload-pack.c
+3 -3
@@ -57,7 +57,6 @@ static struct object_array extra_edge_obj;
57 static int keepalive = 5;
58 static const char *pack_objects_hook;
59
60 -static int filter_capability_requested;
60 static int allow_filter;
61 static int allow_ref_in_want;
62
@@ -93,6 +92,7 @@ struct upload_pack_data {
92 unsigned stateless_rpc : 1; /* v0 only */
93 unsigned no_done : 1; /* v0 only */
94 unsigned daemon_mode : 1; /* v0 only */
95 + unsigned filter_capability_requested : 1; /* v0 only */
96
97 unsigned use_thin_pack : 1;
98 unsigned use_ofs_delta : 1;
@@ -943,7 +943,7 @@ static void receive_needs(struct upload_pack_data *data,
943 continue;
944
945 if (skip_prefix(reader->line, "filter ", &arg)) {
946 - if (!filter_capability_requested)
946 + if (!data->filter_capability_requested)
947 die("git upload-pack: filtering capability not negotiated");
948 list_objects_filter_die_if_populated(&data->filter_options);
949 parse_list_objects_filter(&data->filter_options, arg);
@@ -976,7 +976,7 @@ static void receive_needs(struct upload_pack_data *data,
976 if (parse_feature_request(features, "include-tag"))
977 data->use_include_tag = 1;
978 if (allow_filter && parse_feature_request(features, "filter"))
979 - filter_capability_requested = 1;
979 + data->filter_capability_requested = 1;
980
981 o = parse_object(the_repository, &oid_buf);
982 if (!o) {