Skip to content

Commit d2bc62b

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f8e56da commit d2bc62b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

pack-bitmap-write.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ struct bitmap_writer {
2828
struct ewah_bitmap *blobs;
2929
struct ewah_bitmap *tags;
3030

31-
khash_sha1 *bitmaps;
32-
khash_sha1 *reused;
31+
kh_oid_map_t *bitmaps;
32+
kh_oid_map_t *reused;
3333
struct packing_data *to_pack;
3434

3535
struct bitmapped_commit *selected;
@@ -175,7 +175,7 @@ add_to_include_set(struct bitmap *base, struct commit *commit)
175175
if (bitmap_get(base, bitmap_pos))
176176
return 0;
177177

178-
hash_pos = kh_get_sha1(writer.bitmaps, commit->object.oid.hash);
178+
hash_pos = kh_get_oid_map(writer.bitmaps, commit->object.oid);
179179
if (hash_pos < kh_end(writer.bitmaps)) {
180180
struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
181181
bitmap_or_ewah(base, bc->bitmap);
@@ -256,7 +256,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
256256
struct bitmap *base = bitmap_new();
257257
struct rev_info revs;
258258

259-
writer.bitmaps = kh_init_sha1();
259+
writer.bitmaps = kh_init_oid_map();
260260
writer.to_pack = to_pack;
261261

262262
if (writer.show_progress)
@@ -311,7 +311,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
311311
if (i >= reuse_after)
312312
stored->flags |= BITMAP_FLAG_REUSE;
313313

314-
hash_pos = kh_put_sha1(writer.bitmaps, object->oid.hash, &hash_ret);
314+
hash_pos = kh_put_oid_map(writer.bitmaps, object->oid, &hash_ret);
315315
if (hash_ret == 0)
316316
die("Duplicate entry when writing index: %s",
317317
oid_to_hex(&object->oid));
@@ -366,7 +366,7 @@ void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack)
366366
if (!(bitmap_git = prepare_bitmap_git(to_pack->repo)))
367367
return;
368368

369-
writer.reused = kh_init_sha1();
369+
writer.reused = kh_init_oid_map();
370370
rebuild_existing_bitmaps(bitmap_git, to_pack, writer.reused,
371371
writer.show_progress);
372372
/*
@@ -382,7 +382,7 @@ static struct ewah_bitmap *find_reused_bitmap(const struct object_id *oid)
382382
if (!writer.reused)
383383
return NULL;
384384

385-
hash_pos = kh_get_sha1(writer.reused, oid->hash);
385+
hash_pos = kh_get_oid_map(writer.reused, *oid);
386386
if (hash_pos >= kh_end(writer.reused))
387387
return NULL;
388388

pack-bitmap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ static int rebuild_bitmap(uint32_t *reposition,
10411041

10421042
int rebuild_existing_bitmaps(struct bitmap_index *bitmap_git,
10431043
struct packing_data *mapping,
1044-
khash_sha1 *reused_bitmaps,
1044+
kh_oid_map_t *reused_bitmaps,
10451045
int show_progress)
10461046
{
10471047
uint32_t i, num_objects;
@@ -1080,9 +1080,9 @@ int rebuild_existing_bitmaps(struct bitmap_index *bitmap_git,
10801080
if (!rebuild_bitmap(reposition,
10811081
lookup_stored_bitmap(stored),
10821082
rebuild)) {
1083-
hash_pos = kh_put_sha1(reused_bitmaps,
1084-
stored->oid.hash,
1085-
&hash_ret);
1083+
hash_pos = kh_put_oid_map(reused_bitmaps,
1084+
stored->oid,
1085+
&hash_ret);
10861086
kh_value(reused_bitmaps, hash_pos) =
10871087
bitmap_to_ewah(rebuild);
10881088
}

pack-bitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
5151
struct packed_git **packfile,
5252
uint32_t *entries, off_t *up_to);
5353
int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
54-
khash_sha1 *reused_bitmaps, int show_progress);
54+
kh_oid_map_t *reused_bitmaps, int show_progress);
5555
void free_bitmap_index(struct bitmap_index *);
5656

5757
/*

0 commit comments

Comments
 (0)