@@ -80,6 +80,11 @@ static struct option *add_common_options(struct option *prev)
static int git_multi_pack_index_write_config(const char *var, const char *value,
void *cb UNUSED)
{
+ if (!strcmp(var, "pack.useroaringbitmap")) {
+ if (git_config_bool(var, value))
+ opts.flags |= MIDX_WRITE_ROARING_BITMAP;
+ }
+
if (!strcmp(var, "pack.writebitmaphashcache")) {
if (git_config_bool(var, value))
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
@@ -228,7 +228,7 @@ static enum {
WRITE_BITMAP_QUIET,
WRITE_BITMAP_TRUE,
} write_bitmap_index;
-static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;
+static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE | BITMAP_SET_EWAH_BITMAP;
static int exclude_promisor_objects;
@@ -1258,6 +1258,7 @@ static void write_pack_file(void)
hash_to_hex(hash));
if (write_bitmap_index) {
+ bitmap_writer_init_bm_type(write_bitmap_options);
bitmap_writer_set_checksum(hash);
bitmap_writer_build_type_index(
&to_pack, written_list, nr_written);
@@ -3143,6 +3144,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
cache_max_small_delta_size = git_config_int(k, v);
return 0;
}
+ if (!strcmp(k, "pack.useroaringbitmap")) {
+ if (git_config_bool(k, v))
+ write_bitmap_options |= BITMAP_SET_ROARING_BITMAP;
+ }
if (!strcmp(k, "pack.writebitmaphashcache")) {
if (git_config_bool(k, v))
write_bitmap_options |= BITMAP_OPT_HASH_CACHE;
@@ -1112,10 +1112,16 @@ static int write_midx_bitmap(const char *midx_name,
{
int ret, i;
uint16_t options = 0;
+ unsigned version = 0;
struct pack_idx_entry **index;
char *bitmap_name = xstrfmt("%s-%s.bitmap", midx_name,
hash_to_hex(midx_hash));
+ if (flags & MIDX_WRITE_ROARING_BITMAP)
+ version |= BITMAP_SET_ROARING_BITMAP;
+ else
+ version |= BITMAP_SET_EWAH_BITMAP;
+
if (flags & MIDX_WRITE_BITMAP_HASH_CACHE)
options |= BITMAP_OPT_HASH_CACHE;
@@ -1131,6 +1137,7 @@ static int write_midx_bitmap(const char *midx_name,
for (i = 0; i < pdata->nr_objects; i++)
index[i] = &pdata->objects[i].idx;
+ bitmap_writer_init_bm_type(version);
bitmap_writer_show_progress(flags & MIDX_PROGRESS);
bitmap_writer_build_type_index(pdata, index, pdata->nr_objects);
@@ -48,6 +48,7 @@ struct multi_pack_index {
#define MIDX_WRITE_BITMAP (1 << 2)
#define MIDX_WRITE_BITMAP_HASH_CACHE (1 << 3)
#define MIDX_WRITE_BITMAP_LOOKUP_TABLE (1 << 4)
+#define MIDX_WRITE_ROARING_BITMAP (1 << 5)
const unsigned char *get_midx_checksum(struct multi_pack_index *m);
void get_midx_filename(struct strbuf *out, const char *object_dir);
@@ -30,9 +30,6 @@ struct bitmap_disk_header {
#define NEEDS_BITMAP (1u<<22)
-#define BITMAP_SET_EWAH_BITMAP 0x1
-#define BITMAP_SET_ROARING_BITMAP (1 << 1)
-
/*
* The width in bytes of a single triplet in the lookup table
* extension:
@@ -44,7 +41,9 @@ struct bitmap_disk_header {
enum pack_bitmap_opts {
BITMAP_OPT_FULL_DAG = 0x1,
- BITMAP_OPT_HASH_CACHE = 0x4,
+ BITMAP_SET_EWAH_BITMAP = 0x2,
+ BITMAP_SET_ROARING_BITMAP = 0x4,
+ BITMAP_OPT_HASH_CACHE = 0x8,
BITMAP_OPT_LOOKUP_TABLE = 0x10,
};