pack-bitmap: convert khash_sha1 maps into kh_oid_map
All of the users of our khash_sha1 maps actually have a "struct object_id". Let's use the more descriptive type. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f8e56da97d
commit
d2bc62b1fa
@ -28,8 +28,8 @@ struct bitmap_writer {
|
|||||||
struct ewah_bitmap *blobs;
|
struct ewah_bitmap *blobs;
|
||||||
struct ewah_bitmap *tags;
|
struct ewah_bitmap *tags;
|
||||||
|
|
||||||
khash_sha1 *bitmaps;
|
kh_oid_map_t *bitmaps;
|
||||||
khash_sha1 *reused;
|
kh_oid_map_t *reused;
|
||||||
struct packing_data *to_pack;
|
struct packing_data *to_pack;
|
||||||
|
|
||||||
struct bitmapped_commit *selected;
|
struct bitmapped_commit *selected;
|
||||||
@ -175,7 +175,7 @@ add_to_include_set(struct bitmap *base, struct commit *commit)
|
|||||||
if (bitmap_get(base, bitmap_pos))
|
if (bitmap_get(base, bitmap_pos))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hash_pos = kh_get_sha1(writer.bitmaps, commit->object.oid.hash);
|
hash_pos = kh_get_oid_map(writer.bitmaps, commit->object.oid);
|
||||||
if (hash_pos < kh_end(writer.bitmaps)) {
|
if (hash_pos < kh_end(writer.bitmaps)) {
|
||||||
struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
|
struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
|
||||||
bitmap_or_ewah(base, bc->bitmap);
|
bitmap_or_ewah(base, bc->bitmap);
|
||||||
@ -256,7 +256,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
|
|||||||
struct bitmap *base = bitmap_new();
|
struct bitmap *base = bitmap_new();
|
||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
|
|
||||||
writer.bitmaps = kh_init_sha1();
|
writer.bitmaps = kh_init_oid_map();
|
||||||
writer.to_pack = to_pack;
|
writer.to_pack = to_pack;
|
||||||
|
|
||||||
if (writer.show_progress)
|
if (writer.show_progress)
|
||||||
@ -311,7 +311,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
|
|||||||
if (i >= reuse_after)
|
if (i >= reuse_after)
|
||||||
stored->flags |= BITMAP_FLAG_REUSE;
|
stored->flags |= BITMAP_FLAG_REUSE;
|
||||||
|
|
||||||
hash_pos = kh_put_sha1(writer.bitmaps, object->oid.hash, &hash_ret);
|
hash_pos = kh_put_oid_map(writer.bitmaps, object->oid, &hash_ret);
|
||||||
if (hash_ret == 0)
|
if (hash_ret == 0)
|
||||||
die("Duplicate entry when writing index: %s",
|
die("Duplicate entry when writing index: %s",
|
||||||
oid_to_hex(&object->oid));
|
oid_to_hex(&object->oid));
|
||||||
@ -366,7 +366,7 @@ void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack)
|
|||||||
if (!(bitmap_git = prepare_bitmap_git(to_pack->repo)))
|
if (!(bitmap_git = prepare_bitmap_git(to_pack->repo)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
writer.reused = kh_init_sha1();
|
writer.reused = kh_init_oid_map();
|
||||||
rebuild_existing_bitmaps(bitmap_git, to_pack, writer.reused,
|
rebuild_existing_bitmaps(bitmap_git, to_pack, writer.reused,
|
||||||
writer.show_progress);
|
writer.show_progress);
|
||||||
/*
|
/*
|
||||||
@ -382,7 +382,7 @@ static struct ewah_bitmap *find_reused_bitmap(const struct object_id *oid)
|
|||||||
if (!writer.reused)
|
if (!writer.reused)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
hash_pos = kh_get_sha1(writer.reused, oid->hash);
|
hash_pos = kh_get_oid_map(writer.reused, *oid);
|
||||||
if (hash_pos >= kh_end(writer.reused))
|
if (hash_pos >= kh_end(writer.reused))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1041,7 +1041,7 @@ static int rebuild_bitmap(uint32_t *reposition,
|
|||||||
|
|
||||||
int rebuild_existing_bitmaps(struct bitmap_index *bitmap_git,
|
int rebuild_existing_bitmaps(struct bitmap_index *bitmap_git,
|
||||||
struct packing_data *mapping,
|
struct packing_data *mapping,
|
||||||
khash_sha1 *reused_bitmaps,
|
kh_oid_map_t *reused_bitmaps,
|
||||||
int show_progress)
|
int show_progress)
|
||||||
{
|
{
|
||||||
uint32_t i, num_objects;
|
uint32_t i, num_objects;
|
||||||
@ -1080,8 +1080,8 @@ int rebuild_existing_bitmaps(struct bitmap_index *bitmap_git,
|
|||||||
if (!rebuild_bitmap(reposition,
|
if (!rebuild_bitmap(reposition,
|
||||||
lookup_stored_bitmap(stored),
|
lookup_stored_bitmap(stored),
|
||||||
rebuild)) {
|
rebuild)) {
|
||||||
hash_pos = kh_put_sha1(reused_bitmaps,
|
hash_pos = kh_put_oid_map(reused_bitmaps,
|
||||||
stored->oid.hash,
|
stored->oid,
|
||||||
&hash_ret);
|
&hash_ret);
|
||||||
kh_value(reused_bitmaps, hash_pos) =
|
kh_value(reused_bitmaps, hash_pos) =
|
||||||
bitmap_to_ewah(rebuild);
|
bitmap_to_ewah(rebuild);
|
||||||
|
@ -51,7 +51,7 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
|
|||||||
struct packed_git **packfile,
|
struct packed_git **packfile,
|
||||||
uint32_t *entries, off_t *up_to);
|
uint32_t *entries, off_t *up_to);
|
||||||
int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
|
int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
|
||||||
khash_sha1 *reused_bitmaps, int show_progress);
|
kh_oid_map_t *reused_bitmaps, int show_progress);
|
||||||
void free_bitmap_index(struct bitmap_index *);
|
void free_bitmap_index(struct bitmap_index *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user