]> git.ipfire.org Git - thirdparty/git.git/commit
pack-bitmap: simplify `reuse_partial_packfile_from_bitmap()` signature
authorTaylor Blau <me@ttaylorr.com>
Thu, 14 Dec 2023 22:24:01 +0000 (17:24 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Dec 2023 22:38:08 +0000 (14:38 -0800)
commit35e156b9de1dcc43673c6050cdb65735a7457c1a
tree9058b1d1de7e621056d1b0ee2973b0f1d95ffded
parente5d48bf38bc0e1f44f4daa7c8e0f75cd9296d020
pack-bitmap: simplify `reuse_partial_packfile_from_bitmap()` signature

The signature of `reuse_partial_packfile_from_bitmap()` currently takes
in a bitmap, as well as three output parameters (filled through
pointers, and passed as arguments), and also returns an integer result.

The output parameters are filled out with: (a) the packfile used for
pack-reuse, (b) the number of objects from that pack that we can reuse,
and (c) a bitmap indicating which objects we can reuse. The return value
is either -1 (when there are no objects to reuse), or 0 (when there is
at least one object to reuse).

Some of these parameters are redundant. Notably, we can infer from the
bitmap how many objects are reused by calling bitmap_popcount(). And we
can similar compute the return value based on that number as well.

As such, clean up the signature of this function to drop the "*entries"
parameter, as well as the int return value, since the single caller of
this function can infer these values themself.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
pack-bitmap.c
pack-bitmap.h