Skip to content

Commit 0f533c7

Browse files
ttaylorrgitster
authored andcommitted
pack-bitmap: read multi-pack bitmaps
This prepares the code in pack-bitmap to interpret the new multi-pack bitmaps described in Documentation/technical/bitmap-format.txt, which mostly involves converting bit positions to accommodate looking them up in a MIDX. Note that there are currently no writers who write multi-pack bitmaps, and that this will be implemented in the subsequent commit. Note also that get_midx_checksum() and get_midx_filename() are made non-static so they can be called from pack-bitmap.c. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a5f9f24 commit 0f533c7

File tree

7 files changed

+336
-42
lines changed

7 files changed

+336
-42
lines changed

builtin/pack-objects.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,11 @@ static void write_reused_pack(struct hashfile *f)
11241124
break;
11251125

11261126
offset += ewah_bit_ctz64(word >> offset);
1127+
/*
1128+
* Can use bit positions directly, even for MIDX
1129+
* bitmaps. See comment in try_partial_reuse()
1130+
* for why.
1131+
*/
11271132
write_reused_pack_one(pos + offset, f, &w_curs);
11281133
display_progress(progress_state, ++written);
11291134
}

midx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ static uint8_t oid_version(void)
4848
}
4949
}
5050

51-
static const unsigned char *get_midx_checksum(struct multi_pack_index *m)
51+
const unsigned char *get_midx_checksum(struct multi_pack_index *m)
5252
{
5353
return m->data + m->data_len - the_hash_algo->rawsz;
5454
}
5555

56-
static char *get_midx_filename(const char *object_dir)
56+
char *get_midx_filename(const char *object_dir)
5757
{
5858
return xstrfmt("%s/pack/multi-pack-index", object_dir);
5959
}

midx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ struct multi_pack_index {
4242
#define MIDX_PROGRESS (1 << 0)
4343
#define MIDX_WRITE_REV_INDEX (1 << 1)
4444

45+
const unsigned char *get_midx_checksum(struct multi_pack_index *m);
46+
char *get_midx_filename(const char *object_dir);
4547
char *get_midx_rev_filename(struct multi_pack_index *m);
4648

4749
struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);

pack-bitmap-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void bitmap_writer_show_progress(int show)
4848
}
4949

5050
/**
51-
* Build the initial type index for the packfile
51+
* Build the initial type index for the packfile or multi-pack-index
5252
*/
5353
void bitmap_writer_build_type_index(struct packing_data *to_pack,
5454
struct pack_idx_entry **index,

0 commit comments

Comments
 (0)