From 28a592e4f4870bdd444675b7240920d0879a9c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 5 Aug 2021 03:25:38 +0200 Subject: serve.[ch]: don't pass "struct strvec *keys" to commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- upload-pack.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'upload-pack.h') diff --git a/upload-pack.h b/upload-pack.h index 27ddcdc6cb..63e3252c98 100644 --- a/upload-pack.h +++ b/upload-pack.h @@ -11,10 +11,8 @@ struct upload_pack_options { void upload_pack(struct upload_pack_options *options); struct repository; -struct strvec; struct packet_reader; -int upload_pack_v2(struct repository *r, struct strvec *keys, - struct packet_reader *request); +int upload_pack_v2(struct repository *r, struct packet_reader *request); struct strbuf; int upload_pack_advertise(struct repository *r, -- cgit v1.2.3 From f234da80197b3115cd3c280e98d3393a884a9327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 5 Aug 2021 03:25:42 +0200 Subject: serve.[ch]: remove "serve_options", split up --advertise-refs code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "advertise capabilities" mode of serve.c added in ed10cb952d3 (serve: introduce git-serve, 2018-03-15) is only used by the http-backend.c to call {upload,receive}-pack with the --advertise-refs parameter. See 42526b478e3 (Add stateless RPC options to upload-pack, receive-pack, 2009-10-30). Let's just make cmd_upload_pack() take the two (v2) or three (v2) parameters the the v2/v1 servicing functions need directly, and pass those in via the function signature. The logic of whether daemon mode is implied by the timeout belongs in the v1 function (only used there). Once we split up the "advertise v2 refs" from "serve v2 request" it becomes clear that v2 never cared about those in combination. The only time it mattered was for v1 to emit its ref advertisement, in that case we wanted to emit the smart-http-only "no-done" capability. Since we only do that in the --advertise-refs codepath let's just have it set "do_done" itself in v1's upload_pack() just before send_ref(), at that point --advertise-refs and --stateless-rpc in combination are redundant (the only user is get_info_refs() in http-backend.c), so we can just pass in --advertise-refs only. Since we need to touch all the serve() and advertise_capabilities() codepaths let's rename them to less clever and obvious names, it's been suggested numerous times, the latest of which is [1]'s suggestion for protocol_v2_serve_loop(). Let's go with that. 1. https://lore.kernel.org/git/CAFQ2z_NyGb8rju5CKzmo6KhZXD0Dp21u-BbyCb2aNxLEoSPRJw@mail.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- upload-pack.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'upload-pack.h') diff --git a/upload-pack.h b/upload-pack.h index 63e3252c98..d6ee25ea98 100644 --- a/upload-pack.h +++ b/upload-pack.h @@ -1,14 +1,8 @@ #ifndef UPLOAD_PACK_H #define UPLOAD_PACK_H -struct upload_pack_options { - int stateless_rpc; - int advertise_refs; - unsigned int timeout; - int daemon_mode; -}; - -void upload_pack(struct upload_pack_options *options); +void upload_pack(const int advertise_refs, const int stateless_rpc, + const int timeout); struct repository; struct packet_reader; -- cgit v1.2.3