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

Function test_bitmap_walk

pack-bitmap.c:2791–2860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2789}
2790
2791void test_bitmap_walk(struct rev_info *revs)
2792{
2793 struct object *root;
2794 struct bitmap *result = NULL;
2795 size_t result_popcnt;
2796 struct bitmap_test_data tdata;
2797 struct bitmap_index *bitmap_git, *found;
2798 struct ewah_bitmap *bm;
2799
2800 if (!(bitmap_git = prepare_bitmap_git(revs->repo)))
2801 die(_("failed to load bitmap indexes"));
2802
2803 if (revs->pending.nr != 1)
2804 die(_("you must specify exactly one commit to test"));
2805
2806 fprintf_ln(stderr, "Bitmap v%d test (%d entries%s, %d total)",
2807 bitmap_git->version,
2808 bitmap_git->entry_count,
2809 bitmap_git->table_lookup ? "" : " loaded",
2810 bitmap_total_entry_count(bitmap_git));
2811
2812 root = revs->pending.objects[0].item;
2813 bm = find_bitmap_for_commit(bitmap_git, (struct commit *)root, &found);
2814
2815 if (bm) {
2816 fprintf_ln(stderr, "Found bitmap for '%s'. %d bits / %08x checksum",
2817 oid_to_hex(&root->oid),
2818 (int)bm->bit_size, ewah_checksum(bm));
2819
2820 if (bitmap_is_midx(found))
2821 fprintf_ln(stderr, "Located via MIDX '%s'.",
2822 midx_get_checksum_hex(found->midx));
2823 else
2824 fprintf_ln(stderr, "Located via pack '%s'.",
2825 hash_to_hex_algop(found->pack->hash,
2826 revs->repo->hash_algo));
2827
2828 result = ewah_to_bitmap(bm);
2829 }
2830
2831 if (!result)
2832 die(_("commit '%s' doesn't have an indexed bitmap"), oid_to_hex(&root->oid));
2833
2834 revs->tag_objects = 1;
2835 revs->tree_objects = 1;
2836 revs->blob_objects = 1;
2837
2838 result_popcnt = bitmap_popcount(result);
2839
2840 if (prepare_revision_walk(revs))
2841 die(_("revision walk setup failed"));
2842
2843 bitmap_test_data_prepare(&tdata, bitmap_git);
2844 tdata.prg = start_progress(revs->repo,
2845 "Verifying bitmap entries",
2846 result_popcnt);
2847
2848 traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);

Callers 1

cmd_rev_listFunction · 0.85

Calls 15

prepare_bitmap_gitFunction · 0.85
fprintf_lnFunction · 0.85
bitmap_total_entry_countFunction · 0.85
find_bitmap_for_commitFunction · 0.85
oid_to_hexFunction · 0.85
ewah_checksumFunction · 0.85
bitmap_is_midxFunction · 0.85
midx_get_checksum_hexFunction · 0.85
hash_to_hex_algopFunction · 0.85
ewah_to_bitmapFunction · 0.85
bitmap_popcountFunction · 0.85
prepare_revision_walkFunction · 0.85

Tested by

no test coverage detected