Subject: Re: [PATCH v2 5/8] list-objects: implement object type filter

From: Jeff King <[email-masked]>
Date: Tue, 6 Apr 2021 13:42:56 -0400

On Mon, Mar 15, 2021 at 02:14:50PM +0100, Patrick Steinhardt wrote:

> While it already is possible to filter objects by some criteria in
> git-rev-list(1), it is not yet possible to filter out only a specific
> type of objects. This makes some filters less useful. The `blob:limit`
> filter for example filters blobs such that only those which are smaller
> than the given limit are returned. But it is unfit to ask only for these
> smallish blobs, given that git-rev-list(1) will continue to print tags,
> commits and trees.
> 
> Now that we have the infrastructure in place to also filter tags and
> commits, we can improve this situation by implementing a new filter
> which selects objects based on their type. Above query can thus
> trivially be implemented with the following command:
> 
>     $ git rev-list --objects --filter=object:type=blob \
>         --filter=blob:limit=200
> 
> Furthermore, this filter allows to optimize for certain other cases: if
> for example only tags or commits have been selected, there is no need to
> walk down trees.

Makes sense, and the implementation looks reasonable to me.

-Peff