]> git.ipfire.org Git - thirdparty/git.git/commit - connect.c
connect.c: refactor sending of agent & object-format
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 16 May 2022 20:10:58 +0000 (20:10 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 May 2022 22:02:09 +0000 (15:02 -0700)
commit86f4e31298e4440a08da277966a52adeb982a1fb
treee4dd9d05d530deb5da7db165f069052008ffde90
parent6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e
connect.c: refactor sending of agent & object-format

Refactor the sending of the "agent" and "object-format" capabilities
into a function.

This was added in its current form in ab67235bc4 (connect: parse v2
refs with correct hash algorithm, 2020-05-25). When we connect to a v2
server we need to know about its object-format, and it needs to know
about ours. Since most things in connect.c and transport.c piggy-back
on the eager getting of remote refs via the handshake() those commands
can make use of the just-sent-over object-format by ls-refs.

But I'm about to add a command that may come after ls-refs, and may
not, but we need the server to know about our user-agent and
object-format. So let's split this into a function.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c