| 237 | static struct discovery *last_discovery; |
| 238 | |
| 239 | static 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 |
no test coverage detected