summaryrefslogtreecommitdiff
path: root/list-objects-filter-options.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2021-04-19 11:46:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-19 21:09:11 (GMT)
commitb0c42a53c9d36ea69f4d2650001f05e98eb347cb (patch)
treed7560bc5644e2fc8d161722c9f54acb3356e1c44 /list-objects-filter-options.h
parent9a2a4f95448890d138a800c8a55c5d5dcfe16082 (diff)
downloadgit-b0c42a53c9d36ea69f4d2650001f05e98eb347cb.zip
git-b0c42a53c9d36ea69f4d2650001f05e98eb347cb.tar.gz
git-b0c42a53c9d36ea69f4d2650001f05e98eb347cb.tar.bz2
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>
Diffstat (limited to 'list-objects-filter-options.h')
-rw-r--r--list-objects-filter-options.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/list-objects-filter-options.h b/list-objects-filter-options.h
index 01767c3..da5b673 100644
--- a/list-objects-filter-options.h
+++ b/list-objects-filter-options.h
@@ -1,6 +1,7 @@
#ifndef LIST_OBJECTS_FILTER_OPTIONS_H
#define LIST_OBJECTS_FILTER_OPTIONS_H
+#include "cache.h"
#include "parse-options.h"
#include "string-list.h"
@@ -13,6 +14,7 @@ enum list_objects_filter_choice {
LOFC_BLOB_LIMIT,
LOFC_TREE_DEPTH,
LOFC_SPARSE_OID,
+ LOFC_OBJECT_TYPE,
LOFC_COMBINE,
LOFC__COUNT /* must be last */
};
@@ -54,6 +56,7 @@ struct list_objects_filter_options {
char *sparse_oid_name;
unsigned long blob_limit_value;
unsigned long tree_exclude_depth;
+ enum object_type object_type;
/* LOFC_COMBINE values */