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

Function http_get_info_packs

http.c:2631–2667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2629}
2630
2631int 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
2663cleanup:
2664 free(url);
2665 strbuf_release(&buf);
2666 return ret;
2667}
2668
2669void release_http_pack_request(struct http_pack_request *preq)
2670{

Callers 2

fetch_indicesFunction · 0.85
fetch_indicesFunction · 0.85

Calls 7

end_url_with_slashFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_detachFunction · 0.85
http_get_strbufFunction · 0.85
parse_oid_hexFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected