pack-bitmap: drop redundant args from `bitmap_writer_build_type_index()`

The previous commit ensures that the bitmap_writer's "to_pack" field is
initialized early on, so the "to_pack" and "index_nr" arguments to
`bitmap_writer_build_type_index()` are redundant.

Drop them and adjust the callers accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Taylor Blau 2024-08-15 13:31:03 -04:00 committed by Junio C Hamano
parent 01e9d12939
commit 125ee4ae80
4 changed files with 8 additions and 13 deletions

View File

@ -1345,7 +1345,7 @@ static void write_pack_file(void)
the_repository, &to_pack);
bitmap_writer_set_checksum(&bitmap_writer, hash);
bitmap_writer_build_type_index(&bitmap_writer,
&to_pack, written_list, nr_written);
written_list);
}

if (cruft)

View File

@ -827,8 +827,7 @@ static int write_midx_bitmap(const char *midx_name,

bitmap_writer_init(&writer, the_repository, pdata);
bitmap_writer_show_progress(&writer, flags & MIDX_PROGRESS);
bitmap_writer_build_type_index(&writer, pdata, index,
pdata->nr_objects);
bitmap_writer_build_type_index(&writer, index);

/*
* bitmap_writer_finish expects objects in lex order, but pack_order

View File

@ -101,9 +101,7 @@ void bitmap_writer_show_progress(struct bitmap_writer *writer, int show)
* Build the initial type index for the packfile or multi-pack-index
*/
void bitmap_writer_build_type_index(struct bitmap_writer *writer,
struct packing_data *to_pack,
struct pack_idx_entry **index,
uint32_t index_nr)
struct pack_idx_entry **index)
{
uint32_t i;

@ -111,13 +109,13 @@ void bitmap_writer_build_type_index(struct bitmap_writer *writer,
writer->trees = ewah_new();
writer->blobs = ewah_new();
writer->tags = ewah_new();
ALLOC_ARRAY(to_pack->in_pack_pos, to_pack->nr_objects);
ALLOC_ARRAY(writer->to_pack->in_pack_pos, writer->to_pack->nr_objects);

for (i = 0; i < index_nr; ++i) {
for (i = 0; i < writer->to_pack->nr_objects; ++i) {
struct object_entry *entry = (struct object_entry *)index[i];
enum object_type real_type;

oe_set_in_pack_pos(to_pack, entry, i);
oe_set_in_pack_pos(writer->to_pack, entry, i);

switch (oe_type(entry)) {
case OBJ_COMMIT:
@ -128,7 +126,7 @@ void bitmap_writer_build_type_index(struct bitmap_writer *writer,
break;

default:
real_type = oid_object_info(to_pack->repo,
real_type = oid_object_info(writer->to_pack->repo,
&entry->idx.oid, NULL);
break;
}

View File

@ -129,9 +129,7 @@ void bitmap_writer_show_progress(struct bitmap_writer *writer, int show);
void bitmap_writer_set_checksum(struct bitmap_writer *writer,
const unsigned char *sha1);
void bitmap_writer_build_type_index(struct bitmap_writer *writer,
struct packing_data *to_pack,
struct pack_idx_entry **index,
uint32_t index_nr);
struct pack_idx_entry **index);
int bitmap_writer_has_bitmapped_object_id(struct bitmap_writer *writer,
const struct object_id *oid);
void bitmap_writer_push_commit(struct bitmap_writer *writer,