]> git.ipfire.org Git - thirdparty/git.git/commit - connect.c
connect: convert get_remote_heads to use struct packet_reader
authorBrandon Williams <bmwill@google.com>
Wed, 14 Mar 2018 18:31:44 +0000 (11:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Mar 2018 21:15:06 +0000 (14:15 -0700)
commit7e3e479b90fd618fb8eb8222738f7cc53ab288fa
tree1b98c55de85860844ef10a2c08223960aad9e564
parent635365eb2f67bc17482c5dbe076f20832cf92ae2
connect: convert get_remote_heads to use struct packet_reader

In order to allow for better control flow when protocol_v2 is introduced
convert 'get_remote_heads()' to use 'struct packet_reader' to read
packet lines.  This enables a client to be able to peek the first line
of a server's response (without consuming it) in order to determine the
protocol version its speaking and then passing control to the
appropriate handler.

This is needed because the initial response from a server speaking
protocol_v0 includes the first ref, while subsequent protocol versions
respond with a version line.  We want to be able to read this first line
without consuming the first ref sent in the protocol_v0 case so that the
protocol version the server is speaking can be determined outside of
'get_remote_heads()' in a future patch.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c