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@xxxxxxxxx> --- serve.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/serve.c b/serve.c index 26829991333..412c2cd1317 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 -- 2.33.0.rc0.597.gc569a812f0a