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

Function parse_git_refs

remote-curl.c:239–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237static struct discovery *last_discovery;
238
239static struct ref *parse_git_refs(struct discovery *heads, int for_push)
240{
241 struct ref *list = NULL;
242 struct packet_reader reader;
243
244 packet_reader_init(&reader, -1, heads->buf, heads->len,
245 PACKET_READ_CHOMP_NEWLINE |
246 PACKET_READ_GENTLE_ON_EOF |
247 PACKET_READ_DIE_ON_ERR_PACKET);
248
249 heads->version = discover_version(&reader);
250 switch (heads->version) {
251 case protocol_v2:
252 /*
253 * Do nothing. This isn't a list of refs but rather a
254 * capability advertisement. Client would have run
255 * 'stateless-connect' so we'll dump this capability listing
256 * and let them request the refs themselves.
257 */
258 break;
259 case protocol_v1:
260 case protocol_v0:
261 get_remote_heads(&reader, &list, for_push ? REF_NORMAL : 0,
262 NULL, &heads->shallow);
263 options.hash_algo = reader.hash_algo;
264 break;
265 case protocol_unknown_version:
266 BUG("unknown protocol version");
267 }
268
269 return list;
270}
271
272/*
273 * Try to detect the hash algorithm used by the remote repository when using

Callers 1

discover_refsFunction · 0.85

Calls 3

packet_reader_initFunction · 0.85
discover_versionFunction · 0.85
get_remote_headsFunction · 0.85

Tested by

no test coverage detected