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

Function fetch_and_setup_pack_index

http.c:2591–2629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2589}
2590
2591static int fetch_and_setup_pack_index(struct packfile_list *packs,
2592 unsigned char *sha1,
2593 const char *base_url)
2594{
2595 struct packed_git *new_pack, *p;
2596 char *tmp_idx = NULL;
2597 int ret;
2598
2599 /*
2600 * If we already have the pack locally, no need to fetch its index or
2601 * even add it to list; we already have all of its objects.
2602 */
2603 repo_for_each_pack(the_repository, p) {
2604 if (hasheq(p->hash, sha1, the_repository->hash_algo))
2605 return 0;
2606 }
2607
2608 tmp_idx = fetch_pack_index(sha1, base_url);
2609 if (!tmp_idx)
2610 return -1;
2611
2612 new_pack = parse_pack_index(the_repository, sha1, tmp_idx);
2613 if (!new_pack) {
2614 free(tmp_idx);
2615 return -1; /* parse_pack_index() already issued error message */
2616 }
2617
2618 ret = verify_pack_index(new_pack);
2619
2620 close_pack_index(new_pack);
2621 free(tmp_idx);
2622 if (ret) {
2623 free(new_pack);
2624 return -1;
2625 }
2626
2627 packfile_list_prepend(packs, new_pack);
2628 return 0;
2629}
2630
2631int http_get_info_packs(const char *base_url, struct packfile_list *packs)
2632{

Callers 1

http_get_info_packsFunction · 0.85

Calls 6

hasheqFunction · 0.85
fetch_pack_indexFunction · 0.85
parse_pack_indexFunction · 0.85
verify_pack_indexFunction · 0.85
close_pack_indexFunction · 0.85
packfile_list_prependFunction · 0.85

Tested by

no test coverage detected