Re: [PATCH 2/4] pack-bitmap.c: make object filtering functions generic
From: Junio C Hamano <hidden>
Date: 2020-05-05 05:12:44
Taylor Blau [off-list ref] writes:
In 4f3bd5606a (pack-bitmap: implement BLOB_NONE filtering, 2020-02-14), filtering support for bitmaps was added for the 'LOFC_BLOB_NONE' filter. In the future, we would like to add support for filters that behave as if they exclude a certain type of object, for e.g., the tree depth filter with depth 0. To prepare for this, make some of the functions used for filtering more generic, such as 'find_tip_blobs' and 'filter_bitmap_blob_none' so that they can work over arbitrary object types. To that end, create 'find_tip_objects' and 'filter_bitmap_exclude_type', and redefine the aforementioned functions in terms of those.
OK, so instead of blobs at the tip, we find objects of requested type at the tip, which makes sense. Similarly, blob_none filter used to exclude blobs at the tip, but a more generic form is to exclude objects of requested type at the tip. And these "more generic" variants are named quite intuitively. Then the blob_none filter becomes a thin wrapper of the more generic one, with hardcoded OBJ_BLOB type. Nicely done.