| 2629 | } |
| 2630 | |
| 2631 | int http_get_info_packs(const char *base_url, struct packfile_list *packs) |
| 2632 | { |
| 2633 | struct http_get_options options = {0}; |
| 2634 | int ret = 0; |
| 2635 | char *url; |
| 2636 | const char *data; |
| 2637 | struct strbuf buf = STRBUF_INIT; |
| 2638 | struct object_id oid; |
| 2639 | |
| 2640 | end_url_with_slash(&buf, base_url); |
| 2641 | strbuf_addstr(&buf, "objects/info/packs"); |
| 2642 | url = strbuf_detach(&buf, NULL); |
| 2643 | |
| 2644 | options.no_cache = 1; |
| 2645 | ret = http_get_strbuf(url, &buf, &options); |
| 2646 | if (ret != HTTP_OK) |
| 2647 | goto cleanup; |
| 2648 | |
| 2649 | data = buf.buf; |
| 2650 | while (*data) { |
| 2651 | if (skip_prefix(data, "P pack-", &data) && |
| 2652 | !parse_oid_hex(data, &oid, &data) && |
| 2653 | skip_prefix(data, ".pack", &data) && |
| 2654 | (*data == '\n' || *data == '\0')) { |
| 2655 | fetch_and_setup_pack_index(packs, oid.hash, base_url); |
| 2656 | } else { |
| 2657 | data = strchrnul(data, '\n'); |
| 2658 | } |
| 2659 | if (*data) |
| 2660 | data++; /* skip past newline */ |
| 2661 | } |
| 2662 | |
| 2663 | cleanup: |
| 2664 | free(url); |
| 2665 | strbuf_release(&buf); |
| 2666 | return ret; |
| 2667 | } |
| 2668 | |
| 2669 | void release_http_pack_request(struct http_pack_request *preq) |
| 2670 | { |
no test coverage detected