]> git.ipfire.org Git - thirdparty/git.git/commit - list-objects-filter-options.h
list-objects: implement object type filter
authorPatrick Steinhardt <ps@pks.im>
Mon, 19 Apr 2021 11:46:53 +0000 (13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Apr 2021 21:09:11 +0000 (14:09 -0700)
commitb0c42a53c9d36ea69f4d2650001f05e98eb347cb
treed7560bc5644e2fc8d161722c9f54acb3356e1c44
parent9a2a4f95448890d138a800c8a55c5d5dcfe16082
list-objects: implement object type filter

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.

The new filter is not yet supported in bitmaps. This is going to be
implemented in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/uploadpack.txt
Documentation/rev-list-options.txt
list-objects-filter-options.c
list-objects-filter-options.h
list-objects-filter.c
t/t6112-rev-list-filters-objects.sh