pack-bitmap: factor out type iterator initialization
commit551cf8b655fa73c90dabea633d41b5f10deffaf2
authorJeff King <peff@peff.net>
Thu, 13 Feb 2020 02:16:15 +0000 (12 21:16 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Feb 2020 17:08:58 +0000 (13 09:08 -0800)
tree383f605a4a3c209ce9935ad38d99f8422207047c
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783
pack-bitmap: factor out type iterator initialization

When count_object_type() wants to iterate over the bitmap of all objects
of a certain type, we have to pair up OBJ_COMMIT with bitmap->commits,
and so forth. Since we're about to add more code to iterate over these
bitmaps, let's pull the initialization into its own function.

We can also use this to simplify traverse_bitmap_commit_list(). It
accomplishes the same thing by manually passing the object type and the
bitmap to show_objects_for_type(), but using our helper we just need the
object type.

Note there's one small code change here: previously we'd simply return
zero when counting an unknown object type, and now we'll BUG(). This
shouldn't matter in practice, as all of the callers pass in only usual
commit/tree/blob/tag types.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-bitmap.c