Re: [PATCH 01/13] pack-bitmap: factor out type iterator initialization
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 13, 2020, 17:45 UTC
- Message-ID
- <xmqqlfp6s7o5.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20200213021615.GA1126038@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> 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> > --- > pack-bitmap.c | 63 +++++++++++++++++++++++++++------------------------ > 1 file changed, 33 insertions(+), 30 deletions(-)
Nicely written and makes perfect sense. show_objects_for_type() used to have a redundant pair of parameters, but it is impossible to pass them inconsistently after this change.
Thanks.