Skip to content

Commit 59abe19

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f203a88 commit 59abe19

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

upload-pack.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ static int shallow_nr;
5555
static struct object_array extra_edge_obj;
5656
static const char *pack_objects_hook;
5757

58-
static int allow_filter;
5958
static int allow_ref_in_want;
6059

6160
static int allow_sideband_all;
@@ -102,6 +101,7 @@ struct upload_pack_data {
102101
unsigned use_ofs_delta : 1;
103102
unsigned no_progress : 1;
104103
unsigned use_include_tag : 1;
104+
unsigned allow_filter : 1;
105105

106106
unsigned done : 1; /* v2 only */
107107
};
@@ -984,7 +984,8 @@ static void receive_needs(struct upload_pack_data *data,
984984
data->no_progress = 1;
985985
if (parse_feature_request(features, "include-tag"))
986986
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"))
988989
data->filter_capability_requested = 1;
989990

990991
o = parse_object(the_repository, &oid_buf);
@@ -1090,7 +1091,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
10901091
" allow-reachable-sha1-in-want" : "",
10911092
data->stateless_rpc ? " no-done" : "",
10921093
symref_info.buf,
1093-
allow_filter ? " filter" : "",
1094+
data->allow_filter ? " filter" : "",
10941095
git_user_agent_sanitized());
10951096
strbuf_release(&symref_info);
10961097
} else {
@@ -1142,7 +1143,7 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
11421143
if (!data->keepalive)
11431144
data->keepalive = -1;
11441145
} else if (!strcmp("uploadpack.allowfilter", var)) {
1145-
allow_filter = git_config_bool(var, value);
1146+
data->allow_filter = git_config_bool(var, value);
11461147
} else if (!strcmp("uploadpack.allowrefinwant", var)) {
11471148
allow_ref_in_want = git_config_bool(var, value);
11481149
} else if (!strcmp("uploadpack.allowsidebandall", var)) {
@@ -1334,7 +1335,7 @@ static void process_args(struct packet_reader *request,
13341335
continue;
13351336
}
13361337

1337-
if (allow_filter && skip_prefix(arg, "filter ", &p)) {
1338+
if (data->allow_filter && skip_prefix(arg, "filter ", &p)) {
13381339
list_objects_filter_die_if_populated(&data->filter_options);
13391340
parse_list_objects_filter(&data->filter_options, p);
13401341
continue;

0 commit comments

Comments
 (0)