Skip to content

Commit 5befe8a

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eea7f7a commit 5befe8a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

serve.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ static void advertise_capabilities(void)
112112
struct strbuf value = STRBUF_INIT;
113113
int i;
114114

115+
/* serve by default supports v2 */
116+
packet_write_fmt(1, "version 2\n");
117+
115118
for (i = 0; i < ARRAY_SIZE(capabilities); i++) {
116119
struct protocol_capability *c = &capabilities[i];
117120

@@ -304,9 +307,6 @@ static int process_request(void)
304307
void serve(struct serve_options *options)
305308
{
306309
if (options->advertise_capabilities || !options->stateless_rpc) {
307-
/* serve by default supports v2 */
308-
packet_write_fmt(1, "version 2\n");
309-
310310
advertise_capabilities();
311311
/*
312312
* If only the list of capabilities was requested exit

0 commit comments

Comments
 (0)