summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-08-15 19:31:03 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-15 20:20:24 +0200
commit125ee4ae80e3661c3208fc1c8db0c619e5f625d2 (patch)
tree9d6a990388e8e99884c77fe18081db937395c6c8
parentpack-bitmap: initialize `bitmap_writer_init()` with packing_data (diff)
downloadgit-125ee4ae80e3661c3208fc1c8db0c619e5f625d2.tar.xz
git-125ee4ae80e3661c3208fc1c8db0c619e5f625d2.zip
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>
-rw-r--r--builtin/pack-objects.c2
-rw-r--r--midx-write.c3
-rw-r--r--pack-bitmap-write.c12
-rw-r--r--pack-bitmap.h4
4 files changed, 8 insertions, 13 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 0ad533c045..c08a62718d 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -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)
diff --git a/midx-write.c b/midx-write.c
index 62f507eb72..b3015af07f 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -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
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 4a7d2d1370..34cdf5f150 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -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;
}
diff --git a/pack-bitmap.h b/pack-bitmap.h
index ab20d6a0b6..d2529abadc 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -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,