MCPcopy Index your code
hub / github.com/git/git / discover_version

Function discover_version

connect.c:143–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143enum protocol_version discover_version(struct packet_reader *reader)
144{
145 enum protocol_version version = protocol_unknown_version;
146
147 /*
148 * Peek the first line of the server's response to
149 * determine the protocol version the server is speaking.
150 */
151 switch (packet_reader_peek(reader)) {
152 case PACKET_READ_EOF:
153 die_initial_contact(0);
154 case PACKET_READ_FLUSH:
155 case PACKET_READ_DELIM:
156 case PACKET_READ_RESPONSE_END:
157 version = protocol_v0;
158 break;
159 case PACKET_READ_NORMAL:
160 version = determine_protocol_version_client(reader->line);
161 break;
162 }
163
164 switch (version) {
165 case protocol_v2:
166 process_capabilities_v2(reader);
167 break;
168 case protocol_v1:
169 /* Read the peeked version line */
170 packet_reader_read(reader);
171 break;
172 case protocol_v0:
173 break;
174 case protocol_unknown_version:
175 BUG("unknown protocol version");
176 }
177
178 trace2_data_intmax("transfer", NULL, "negotiated-version", version);
179
180 return version;
181}
182
183static void parse_one_symref_info(struct string_list *symref, const char *val, int len)
184{

Callers 4

handshakeFunction · 0.85
parse_git_refsFunction · 0.85
cmd_fetch_packFunction · 0.85
cmd_send_packFunction · 0.85

Calls 5

packet_reader_peekFunction · 0.85
die_initial_contactFunction · 0.85
process_capabilities_v2Function · 0.85
packet_reader_readFunction · 0.85

Tested by

no test coverage detected