MCPcopy Create free account
hub / github.com/git/git / bitmap_writer_build

Function bitmap_writer_build

pack-bitmap-write.c:915–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913}
914
915int bitmap_writer_build(struct bitmap_writer *writer)
916{
917 struct bitmap_builder bb;
918 size_t i;
919 int nr_stored = 0; /* for progress */
920 struct prio_queue queue = { compare_commits_by_gen_then_commit_date };
921 struct prio_queue tree_queue = { NULL };
922 struct bitmap_index *old_bitmap;
923 uint32_t *mapping = NULL;
924 int closed = 1; /* until proven otherwise */
925
926 if (writer->show_progress)
927 writer->progress = start_progress(writer->repo,
928 "Building bitmaps",
929 writer->selected_nr);
930
931 writer->pos_cache_hits = 0;
932 writer->pos_cache_misses = 0;
933
934 trace2_region_enter("pack-bitmap-write", "building_bitmaps_total",
935 writer->repo);
936
937 old_bitmap = prepare_bitmap_git(writer->to_pack->repo);
938 if (old_bitmap)
939 mapping = create_bitmap_mapping(old_bitmap, writer->to_pack);
940 else
941 mapping = NULL;
942
943 bitmap_builder_init(&bb, writer, old_bitmap);
944 for (i = bb.commits.nr; i > 0; i--) {
945 struct commit *commit = bb.commits.items[i-1];
946 struct bb_commit *ent = bb_data_at(&bb.data, commit);
947 struct commit *child;
948 int reused = 0;
949
950 if (fill_bitmap_commit(writer, ent, commit, &queue, &tree_queue,
951 old_bitmap, mapping) < 0) {
952 closed = 0;
953 break;
954 }
955
956 if (ent->selected) {
957 store_selected(writer, ent, commit);
958 nr_stored++;
959 display_progress(writer->progress, nr_stored);
960 }
961
962 while ((child = pop_commit(&ent->reverse_edges))) {
963 struct bb_commit *child_ent =
964 bb_data_at(&bb.data, child);
965
966 if (child_ent->bitmap)
967 bitmap_or(child_ent->bitmap, ent->bitmap);
968 else if (reused)
969 child_ent->bitmap = bitmap_dup(ent->bitmap);
970 else {
971 child_ent->bitmap = ent->bitmap;
972 reused = 1;

Callers 3

write_midx_bitmapFunction · 0.85
bitmap_writeFunction · 0.85
write_pack_fileFunction · 0.85

Calls 15

start_progressFunction · 0.85
prepare_bitmap_gitFunction · 0.85
create_bitmap_mappingFunction · 0.85
bitmap_builder_initFunction · 0.85
fill_bitmap_commitFunction · 0.85
store_selectedFunction · 0.85
display_progressFunction · 0.85
pop_commitFunction · 0.85
bitmap_orFunction · 0.85
bitmap_dupFunction · 0.85
bitmap_freeFunction · 0.85

Tested by 1

bitmap_writeFunction · 0.68