serve.[ch]: don't pass "struct strvec *keys" to commands
The serve.c API added in ed10cb952d3 (serve: introduce git-serve, 2018-03-15) was passing in the raw capabilities "keys", but nothing downstream of it ever used them. Let's remove that code because it's not needed. If we do end up needing to pass information about the advertisement in the future it'll make more sense to have serve.c parse the capabilities keys and pass the result of its parsing, rather than expecting expecting its API users to parse the same keys again. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Aug 5, 2021 at 03:25 UTC
28a592e4f4870bdd444675b7240920d0879a9c1b
7 files changed
+9
-21
ls-refs.c
+1
-2
@@ -138,8 +138,7 @@ static int ls_refs_config(const char *var, const char *value, void *data)
138
return parse_hide_refs_config(var, value, "uploadpack");
139
}
140
141
-int ls_refs(struct repository *r, struct strvec *keys,
142
- struct packet_reader *request)
141
+int ls_refs(struct repository *r, struct packet_reader *request)
142
{
143
struct ls_refs_data data;
144
ls-refs.h
+1
-3
@@ -2,10 +2,8 @@
2
#define LS_REFS_H
3
4
struct repository;
5
-struct strvec;
5
struct packet_reader;
7
-int ls_refs(struct repository *r, struct strvec *keys,
8
- struct packet_reader *request);
6
+int ls_refs(struct repository *r, struct packet_reader *request);
7
int ls_refs_advertise(struct repository *r, struct strbuf *value);
8
9
#endif /* LS_REFS_H */
protocol-caps.c
+1
-2
@@ -74,8 +74,7 @@ static void send_info(struct repository *r, struct packet_writer *writer,
74
}
75
}
76
77
-int cap_object_info(struct repository *r, struct strvec *keys,
78
- struct packet_reader *request)
77
+int cap_object_info(struct repository *r, struct packet_reader *request)
78
{
79
struct requested_info info;
80
struct packet_writer writer;
protocol-caps.h
+1
-3
@@ -2,9 +2,7 @@
2
#define PROTOCOL_CAPS_H
3
4
struct repository;
5
-struct strvec;
5
struct packet_reader;
7
-int cap_object_info(struct repository *r, struct strvec *keys,
8
- struct packet_reader *request);
6
+int cap_object_info(struct repository *r, struct packet_reader *request);
7
8
#endif /* PROTOCOL_CAPS_H */
serve.c
+3
-6
@@ -60,16 +60,13 @@ struct protocol_capability {
60
61
/*
62
* Function called when a client requests the capability as a command.
63
- * The function will be provided the capabilities requested via 'keys'
64
- * as well as a struct packet_reader 'request' which the command should
63
+ * Will be provided a struct packet_reader 'request' which it should
64
* use to read the command specific part of the request. Every command
65
* MUST read until a flush packet is seen before sending a response.
66
*
67
* This field should be NULL for capabilities which are not commands.
68
*/
70
- int (*command)(struct repository *r,
71
- struct strvec *keys,
72
- struct packet_reader *request);
69
+ int (*command)(struct repository *r, struct packet_reader *request);
70
};
71
72
static struct protocol_capability capabilities[] = {
@@ -294,7 +291,7 @@ static int process_request(void)
291
if (has_capability(&keys, "session-id", &client_sid))
292
trace2_data_string("transfer", NULL, "client-sid", client_sid);
293
297
- command->command(the_repository, &keys, &reader);
294
+ command->command(the_repository, &reader);
295
296
strvec_clear(&keys);
297
return 0;
upload-pack.c
+1
-2
@@ -1655,8 +1655,7 @@ enum fetch_state {
1655
FETCH_DONE,
1656
};
1657
1658
-int upload_pack_v2(struct repository *r, struct strvec *keys,
1659
- struct packet_reader *request)
1658
+int upload_pack_v2(struct repository *r, struct packet_reader *request)
1659
{
1660
enum fetch_state state = FETCH_PROCESS_ARGS;
1661
struct upload_pack_data data;
upload-pack.h
+1
-3
@@ -11,10 +11,8 @@ struct upload_pack_options {
11
void upload_pack(struct upload_pack_options *options);
12
13
struct repository;
14
-struct strvec;
14
struct packet_reader;
16
-int upload_pack_v2(struct repository *r, struct strvec *keys,
17
- struct packet_reader *request);
15
+int upload_pack_v2(struct repository *r, struct packet_reader *request);
16
17
struct strbuf;
18
int upload_pack_advertise(struct repository *r,