| 423 | } |
| 424 | |
| 425 | static int http_fetch_pack(struct walker *walker, struct alt_base *repo, |
| 426 | const struct object_id *oid) |
| 427 | { |
| 428 | struct packed_git *target; |
| 429 | int ret; |
| 430 | struct slot_results results; |
| 431 | struct http_pack_request *preq; |
| 432 | |
| 433 | if (fetch_indices(walker, repo)) |
| 434 | return -1; |
| 435 | target = packfile_list_find_oid(repo->packs.head, oid); |
| 436 | if (!target) |
| 437 | return -1; |
| 438 | close_pack_index(target); |
| 439 | |
| 440 | if (walker->get_verbosely) { |
| 441 | fprintf(stderr, "Getting pack %s\n", |
| 442 | hash_to_hex(target->hash)); |
| 443 | fprintf(stderr, " which contains %s\n", |
| 444 | oid_to_hex(oid)); |
| 445 | } |
| 446 | |
| 447 | preq = new_http_pack_request(target->hash, repo->base); |
| 448 | if (!preq) |
| 449 | goto abort; |
| 450 | preq->slot->results = &results; |
| 451 | |
| 452 | if (start_active_slot(preq->slot)) { |
| 453 | run_active_slot(preq->slot); |
| 454 | if (results.curl_result != CURLE_OK) { |
| 455 | error("Unable to get pack file %s\n%s", preq->url, |
| 456 | curl_errorstr); |
| 457 | goto abort; |
| 458 | } |
| 459 | } else { |
| 460 | error("Unable to start request"); |
| 461 | goto abort; |
| 462 | } |
| 463 | |
| 464 | ret = finish_http_pack_request(preq); |
| 465 | release_http_pack_request(preq); |
| 466 | if (ret) |
| 467 | return ret; |
| 468 | http_install_packfile(target, &repo->packs); |
| 469 | |
| 470 | return 0; |
| 471 | |
| 472 | abort: |
| 473 | return -1; |
| 474 | } |
| 475 | |
| 476 | static void abort_object_request(struct object_request *obj_req) |
| 477 | { |
no test coverage detected