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

upload-pack: move allow_filter to upload_pack_data

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'allow_filter' static variable into this struct. It is used by both protocol v0 and protocol v2 code. 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 59abe1962411b7dc9e459cdcee617f96491235a0
1 file changed +6 -5
upload-pack.c
+6 -5
@@ -55,7 +55,6 @@ static int shallow_nr;
55 static struct object_array extra_edge_obj;
56 static const char *pack_objects_hook;
57
58 -static int allow_filter;
58 static int allow_ref_in_want;
59
60 static int allow_sideband_all;
@@ -102,6 +101,7 @@ struct upload_pack_data {
101 unsigned use_ofs_delta : 1;
102 unsigned no_progress : 1;
103 unsigned use_include_tag : 1;
104 + unsigned allow_filter : 1;
105
106 unsigned done : 1; /* v2 only */
107 };
@@ -984,7 +984,8 @@ static void receive_needs(struct upload_pack_data *data,
984 data->no_progress = 1;
985 if (parse_feature_request(features, "include-tag"))
986 data->use_include_tag = 1;
987 - if (allow_filter && parse_feature_request(features, "filter"))
987 + if (data->allow_filter &&
988 + parse_feature_request(features, "filter"))
989 data->filter_capability_requested = 1;
990
991 o = parse_object(the_repository, &oid_buf);
@@ -1090,7 +1091,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
1091 " allow-reachable-sha1-in-want" : "",
1092 data->stateless_rpc ? " no-done" : "",
1093 symref_info.buf,
1093 - allow_filter ? " filter" : "",
1094 + data->allow_filter ? " filter" : "",
1095 git_user_agent_sanitized());
1096 strbuf_release(&symref_info);
1097 } else {
@@ -1142,7 +1143,7 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
1143 if (!data->keepalive)
1144 data->keepalive = -1;
1145 } else if (!strcmp("uploadpack.allowfilter", var)) {
1145 - allow_filter = git_config_bool(var, value);
1146 + data->allow_filter = git_config_bool(var, value);
1147 } else if (!strcmp("uploadpack.allowrefinwant", var)) {
1148 allow_ref_in_want = git_config_bool(var, value);
1149 } else if (!strcmp("uploadpack.allowsidebandall", var)) {
@@ -1334,7 +1335,7 @@ static void process_args(struct packet_reader *request,
1335 continue;
1336 }
1337
1337 - if (allow_filter && skip_prefix(arg, "filter ", &p)) {
1338 + if (data->allow_filter && skip_prefix(arg, "filter ", &p)) {
1339 list_objects_filter_die_if_populated(&data->filter_options);
1340 parse_list_objects_filter(&data->filter_options, p);
1341 continue;