summaryrefslogtreecommitdiffstats
path: root/pseudo-merge.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-05-23 23:26:52 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-24 20:40:43 +0200
commit0f81b9cb2c5984ae1b090eb79d139e0a7d9ad8df (patch)
treeca16fec2de90c29eb4211d180d629b490c2f9c6a /pseudo-merge.c
parentpack-bitmap: extract `read_bitmap()` function (diff)
downloadgit-0f81b9cb2c5984ae1b090eb79d139e0a7d9ad8df.tar.xz
git-0f81b9cb2c5984ae1b090eb79d139e0a7d9ad8df.zip
pseudo-merge: scaffolding for reads
Implement scaffolding within the new pseudo-merge compilation unit necessary to use the pseudo-merge API from within the pack-bitmap.c machinery. The core of this scaffolding is two-fold: - The `pseudo_merge` structure itself, which represents an individual pseudo-merge bitmap. It has fields for both bitmaps, as well as metadata about its position within the memory-mapped region, and a few extra bits indicating whether or not it is satisfied, and which bitmaps(s, if any) have been read, since they are initialized lazily. - The `pseudo_merge_map` structure, which holds an array of pseudo_merges, as well as a pointer to the memory-mapped region containing the pseudo-merge serialization from within a .bitmap file. Note that the `bitmap_index` structure is defined statically within the pack-bitmap.o compilation unit, so we can't take in a `struct bitmap_index *`. Instead, wrap the primary components necessary to read the pseudo-merges in this new structure to avoid exposing the implementation details of the `bitmap_index` structure. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pseudo-merge.c')
-rw-r--r--pseudo-merge.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pseudo-merge.c b/pseudo-merge.c
index 0f6854c753..f0080d53c0 100644
--- a/pseudo-merge.c
+++ b/pseudo-merge.c
@@ -454,3 +454,13 @@ void select_pseudo_merges(struct bitmap_writer *writer,
stop_progress(&progress);
}
+
+void free_pseudo_merge_map(struct pseudo_merge_map *pm)
+{
+ uint32_t i;
+ for (i = 0; i < pm->nr; i++) {
+ ewah_pool_free(pm->v[i].commits);
+ ewah_pool_free(pm->v[i].bitmap);
+ }
+ free(pm->v);
+}