upload-pack: remove static variable 'stateless_rpc'
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's remove the 'stateless_rpc' static variable, as we can now use the field of 'struct upload_pack_data' with the same name instead. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
May 15, 2020 at 12:04 UTC
df654abcccc31aed529a83dd9a0865dc93e79eeb
1 file changed
+7
-6
upload-pack.c
+7
-6
@@ -63,7 +63,6 @@ static int keepalive = 5;
63
* otherwise maximum packet size (up to 65520 bytes).
64
*/
65
static int use_sideband;
66
-static int stateless_rpc;
66
static const char *pack_objects_hook;
67
68
static int filter_capability_requested;
@@ -449,7 +448,7 @@ static int get_common_commits(struct upload_pack_data *data,
448
packet_write_fmt(1, "ACK %s\n", last_hex);
449
return 0;
450
}
452
- if (stateless_rpc)
451
+ if (data->stateless_rpc)
452
exit(0);
453
got_common = 0;
454
got_other = 0;
@@ -663,7 +662,8 @@ static void check_non_tip(struct upload_pack_data *data)
662
* uploadpack.allowReachableSHA1InWant,
663
* non-tip requests can never happen.
664
*/
666
- if (!stateless_rpc && !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
665
+ if (!data->stateless_rpc
666
+ && !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
667
goto error;
668
if (!has_unreachable(&data->want_obj))
669
/* All the non-tip ones are ancestors of what we advertised */
@@ -1074,7 +1074,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
1074
" allow-tip-sha1-in-want" : "",
1075
(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1) ?
1076
" allow-reachable-sha1-in-want" : "",
1077
- stateless_rpc ? " no-done" : "",
1077
+ data->stateless_rpc ? " no-done" : "",
1078
symref_info.buf,
1079
allow_filter ? " filter" : "",
1080
git_user_agent_sanitized());
@@ -1149,7 +1149,6 @@ void upload_pack(struct upload_pack_options *options)
1149
struct packet_reader reader;
1150
struct upload_pack_data data;
1151
1152
- stateless_rpc = options->stateless_rpc;
1152
timeout = options->timeout;
1153
daemon_mode = options->daemon_mode;
1154
@@ -1157,9 +1156,11 @@ void upload_pack(struct upload_pack_options *options)
1156
1157
upload_pack_data_init(&data);
1158
1159
+ data.stateless_rpc = options->stateless_rpc;
1160
+
1161
head_ref_namespaced(find_symref, &data.symref);
1162
1162
- if (options->advertise_refs || !stateless_rpc) {
1163
+ if (options->advertise_refs || !data.stateless_rpc) {
1164
reset_timeout();
1165
head_ref_namespaced(send_ref, &data);
1166
for_each_namespaced_ref(send_ref, &data);