summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-08-05 03:25:40 +0200
committerJunio C Hamano <gitster@pobox.com>2021-08-05 08:59:37 -0700
commit5befe8a1f14e2429fee526acc8dcc23039f5193b (patch)
tree3c614b0a7fdd393a610ec5a546be64c35c8e876d
parenteea7f7a977c61f313774d591ed54ec9d7345fdaf (diff)
downloadgit-5befe8a1f14e2429fee526acc8dcc23039f5193b.tar.gz
serve.c: move version line to advertise_capabilities()
The advertise_capabilities() is only called from serve() and we always emit this version line before it. In a subsequent commit I'll make builtin/upload-pack.c sometimes call advertise_capabilities() directly, so it'll make sense to have this line emitted by advertise_capabilities(), not serve() itself. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--serve.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/serve.c b/serve.c
index 2682999133..412c2cd131 100644
--- a/serve.c
+++ b/serve.c
@@ -112,6 +112,9 @@ static void advertise_capabilities(void)
struct strbuf value = STRBUF_INIT;
int i;
+ /* serve by default supports v2 */
+ packet_write_fmt(1, "version 2\n");
+
for (i = 0; i < ARRAY_SIZE(capabilities); i++) {
struct protocol_capability *c = &capabilities[i];
@@ -304,9 +307,6 @@ static int process_request(void)
void serve(struct serve_options *options)
{
if (options->advertise_capabilities || !options->stateless_rpc) {
- /* serve by default supports v2 */
- packet_write_fmt(1, "version 2\n");
-
advertise_capabilities();
/*
* If only the list of capabilities was requested exit