pack-bitmap: implement `bitmap_writer_has_bitmapped_object_id()`
Prepare to implement pseudo-merge bitmap selection by implementing a necessary new function, `bitmap_writer_has_bitmapped_object_id()`. This function returns whether or not the bitmap_writer selected the given object ID for bitmapping. This will allow the pseudo-merge machinery to reject candidates for pseudo-merges if they have already been selected as an ordinary bitmap tip. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
May 23, 2024 at 17:26 UTC
245a7f2e01dc86baa08ceb70937585c6389cb9db
2 files changed
+8
pack-bitmap-write.c
+6
@@ -130,6 +130,12 @@ void bitmap_writer_build_type_index(struct bitmap_writer *writer,
130
}
131
}
132
133
+int bitmap_writer_has_bitmapped_object_id(struct bitmap_writer *writer,
134
+ const struct object_id *oid)
135
+{
136
+ return kh_get_oid_map(writer->bitmaps, *oid) != kh_end(writer->bitmaps);
137
+}
138
+
139
/**
140
* Compute the actual bitmaps
141
*/
pack-bitmap.h
+2
@@ -125,6 +125,8 @@ void bitmap_writer_build_type_index(struct bitmap_writer *writer,
125
struct packing_data *to_pack,
126
struct pack_idx_entry **index,
127
uint32_t index_nr);
128
+int bitmap_writer_has_bitmapped_object_id(struct bitmap_writer *writer,
129
+ const struct object_id *oid);
130
uint32_t *create_bitmap_mapping(struct bitmap_index *bitmap_git,
131
struct packing_data *mapping);
132
int rebuild_bitmap(const uint32_t *reposition,