pack-bitmap: move some initialization to bitmap_writer_init()
The pack-bitmap-writer machinery uses a oidmap (backed by khash.h) to map from commits selected for bitmaps (by OID) to a bitmapped_commit structure (containing the bitmap itself, among other things like its XOR offset, etc.) This map was initialized at the end of `bitmap_writer_build()`. New entries are added in `pack-bitmap-write.c::store_selected()`, which is called by the bitmap_builder machinery (which is responsible for traversing history and generating the actual bitmaps). Reorganize when this field is initialized and when entries are added to it so that we can quickly determine whether a commit is a candidate for pseudo-merge selection, or not (since it was already selected to receive a bitmap, and thus storing it in a pseudo-merge would be redundant). The changes are as follows: - Introduce a new `bitmap_writer_init()` function which initializes the `writer.bitmaps` field (instead of waiting until the end of `bitmap_writer_build()`). - Add map entries in `push_bitmapped_commit()` (which is called via `bitmap_writer_select_commits()`) with OID keys and NULL values to track whether or not we *expect* to write a bitmap for some given commit. - Validate that a NULL entry is found matching the given key when we store a selected bitmap. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
10a96af8dc
commit
4722e06edc
@ -1340,7 +1340,8 @@ static void write_pack_file(void)
|
||||
hash_to_hex(hash));
|
||||
|
||||
if (write_bitmap_index) {
|
||||
bitmap_writer_init(&bitmap_writer);
|
||||
bitmap_writer_init(&bitmap_writer,
|
||||
the_repository);
|
||||
bitmap_writer_set_checksum(&bitmap_writer, hash);
|
||||
bitmap_writer_build_type_index(&bitmap_writer,
|
||||
&to_pack, written_list, nr_written);
|
||||
|
Reference in New Issue
Block a user