Re: [PATCH v3 11/13] pack-bitmap.c: keep track of each layer's type bitmaps
On Tue, Nov 19, 2024 at 05:07:50PM -0500, Taylor Blau wrote:
Show 23 quoted lines
> @@ -586,7 +604,29 @@ static int load_reverse_index(struct repository *r, struct bitmap_index *bitmap_
> return load_pack_revindex(r, bitmap_git->pack);
> }
>
> -static int load_bitmap(struct repository *r, struct bitmap_index *bitmap_git)
> +static void load_all_type_bitmaps(struct bitmap_index *bitmap_git)
> +{
> + struct bitmap_index *curr = bitmap_git;
> + size_t i = bitmap_git->base_nr - 1;
> +
> + ALLOC_ARRAY(bitmap_git->commits_all, bitmap_git->base_nr);
> + ALLOC_ARRAY(bitmap_git->trees_all, bitmap_git->base_nr);
> + ALLOC_ARRAY(bitmap_git->blobs_all, bitmap_git->base_nr);
> + ALLOC_ARRAY(bitmap_git->tags_all, bitmap_git->base_nr);
> +
> + while (curr) {
> + bitmap_git->commits_all[i] = curr->commits;
> + bitmap_git->trees_all[i] = curr->trees;
> + bitmap_git->blobs_all[i] = curr->blobs;
> + bitmap_git->tags_all[i] = curr->tags;
> +
> + curr = curr->base;
> + i -= 1;Do we want to `BUG()` in case `i == 0` before this statement?
Patrick