Skip to content

Commit df654ab

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b08c974 commit df654ab

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

upload-pack.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ static int keepalive = 5;
6363
* otherwise maximum packet size (up to 65520 bytes).
6464
*/
6565
static int use_sideband;
66-
static int stateless_rpc;
6766
static const char *pack_objects_hook;
6867

6968
static int filter_capability_requested;
@@ -449,7 +448,7 @@ static int get_common_commits(struct upload_pack_data *data,
449448
packet_write_fmt(1, "ACK %s\n", last_hex);
450449
return 0;
451450
}
452-
if (stateless_rpc)
451+
if (data->stateless_rpc)
453452
exit(0);
454453
got_common = 0;
455454
got_other = 0;
@@ -663,7 +662,8 @@ static void check_non_tip(struct upload_pack_data *data)
663662
* uploadpack.allowReachableSHA1InWant,
664663
* non-tip requests can never happen.
665664
*/
666-
if (!stateless_rpc && !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
665+
if (!data->stateless_rpc
666+
&& !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
667667
goto error;
668668
if (!has_unreachable(&data->want_obj))
669669
/* 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,
10741074
" allow-tip-sha1-in-want" : "",
10751075
(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1) ?
10761076
" allow-reachable-sha1-in-want" : "",
1077-
stateless_rpc ? " no-done" : "",
1077+
data->stateless_rpc ? " no-done" : "",
10781078
symref_info.buf,
10791079
allow_filter ? " filter" : "",
10801080
git_user_agent_sanitized());
@@ -1149,17 +1149,18 @@ void upload_pack(struct upload_pack_options *options)
11491149
struct packet_reader reader;
11501150
struct upload_pack_data data;
11511151

1152-
stateless_rpc = options->stateless_rpc;
11531152
timeout = options->timeout;
11541153
daemon_mode = options->daemon_mode;
11551154

11561155
git_config(upload_pack_config, NULL);
11571156

11581157
upload_pack_data_init(&data);
11591158

1159+
data.stateless_rpc = options->stateless_rpc;
1160+
11601161
head_ref_namespaced(find_symref, &data.symref);
11611162

1162-
if (options->advertise_refs || !stateless_rpc) {
1163+
if (options->advertise_refs || !data.stateless_rpc) {
11631164
reset_timeout();
11641165
head_ref_namespaced(send_ref, &data);
11651166
for_each_namespaced_ref(send_ref, &data);

0 commit comments

Comments
 (0)