Skip to content

Commit 28a592e

Browse files
avargitster
authored andcommitted
serve.[ch]: don't pass "struct strvec *keys" to commands
The serve.c API added in ed10cb9 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 85baaed commit 28a592e

7 files changed

+9
-21
lines changed

ls-refs.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ static int ls_refs_config(const char *var, const char *value, void *data)
138138
return parse_hide_refs_config(var, value, "uploadpack");
139139
}
140140

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)
143142
{
144143
struct ls_refs_data data;
145144

ls-refs.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
#define LS_REFS_H
33

44
struct repository;
5-
struct strvec;
65
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);
97
int ls_refs_advertise(struct repository *r, struct strbuf *value);
108

119
#endif /* LS_REFS_H */

protocol-caps.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ static void send_info(struct repository *r, struct packet_writer *writer,
7474
}
7575
}
7676

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)
7978
{
8079
struct requested_info info;
8180
struct packet_writer writer;

protocol-caps.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
#define PROTOCOL_CAPS_H
33

44
struct repository;
5-
struct strvec;
65
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);
97

108
#endif /* PROTOCOL_CAPS_H */

serve.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,13 @@ struct protocol_capability {
6060

6161
/*
6262
* 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
6564
* use to read the command specific part of the request. Every command
6665
* MUST read until a flush packet is seen before sending a response.
6766
*
6867
* This field should be NULL for capabilities which are not commands.
6968
*/
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);
7370
};
7471

7572
static struct protocol_capability capabilities[] = {
@@ -294,7 +291,7 @@ static int process_request(void)
294291
if (has_capability(&keys, "session-id", &client_sid))
295292
trace2_data_string("transfer", NULL, "client-sid", client_sid);
296293

297-
command->command(the_repository, &keys, &reader);
294+
command->command(the_repository, &reader);
298295

299296
strvec_clear(&keys);
300297
return 0;

upload-pack.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1655,8 +1655,7 @@ enum fetch_state {
16551655
FETCH_DONE,
16561656
};
16571657

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)
16601659
{
16611660
enum fetch_state state = FETCH_PROCESS_ARGS;
16621661
struct upload_pack_data data;

upload-pack.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ struct upload_pack_options {
1111
void upload_pack(struct upload_pack_options *options);
1212

1313
struct repository;
14-
struct strvec;
1514
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);
1816

1917
struct strbuf;
2018
int upload_pack_advertise(struct repository *r,

0 commit comments

Comments
 (0)