summaryrefslogtreecommitdiff
path: root/list-objects-filter.h
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2018-10-18 00:39:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-18 03:49:18 (GMT)
commit8b10a206f090e01ce1ac4d9a10ec769e2409e2b0 (patch)
tree13308fe2d78d914e6e5548d144c4368b5980c471 /list-objects-filter.h
parentd9e6d0942bb9f9fe9e4cca9670181e5b59074bcb (diff)
downloadgit-8b10a206f090e01ce1ac4d9a10ec769e2409e2b0.zip
git-8b10a206f090e01ce1ac4d9a10ec769e2409e2b0.tar.gz
git-8b10a206f090e01ce1ac4d9a10ec769e2409e2b0.tar.bz2
list-objects: support for skipping tree traversal
The tree:0 filter does not need to traverse the trees that it has filtered out, so optimize list-objects and list-objects-filter to skip traversing the trees entirely. Before this patch, we iterated over all children of the tree, and did nothing for all of them, which was wasteful. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects-filter.h')
-rw-r--r--list-objects-filter.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/list-objects-filter.h b/list-objects-filter.h
index a963d02..9c19875 100644
--- a/list-objects-filter.h
+++ b/list-objects-filter.h
@@ -20,6 +20,11 @@
* In general, objects should only be shown once, but
* this result DOES NOT imply that we mark it SEEN.
*
+ * _SKIP_TREE : Used in LOFS_BEGIN_TREE situation - indicates that
+ * the tree's children should not be iterated over. This
+ * is used as an optimization when all children will
+ * definitely be ignored.
+ *
* Most of the time, you want the combination (_MARK_SEEN | _DO_SHOW)
* but they can be used independently, such as when sparse-checkout
* pattern matching is being applied.
@@ -41,6 +46,7 @@ enum list_objects_filter_result {
LOFR_ZERO = 0,
LOFR_MARK_SEEN = 1<<0,
LOFR_DO_SHOW = 1<<1,
+ LOFR_SKIP_TREE = 1<<2,
};
enum list_objects_filter_situation {