summary refs log tree commit diff
path: root/pack-bitmap.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2021-04-19 13:47:02 +0200
committerJunio C Hamano <gitster@pobox.com>2021-04-19 14:09:11 -0700
commit169a15ebd66dd23bf8c379ad33bced1578c848ef (patch)
tree15d10df534d51c91698be05e3db7fc240fe6676b /pack-bitmap.c
parent7ab6aafa582b9c537885d4a6ef2c837323c5014d (diff)
pack-bitmap: implement combined filter
When the user has multiple objects filters specified, then this is
internally represented by having a "combined" filter. These combined
filters aren't yet supported by bitmap indices and can thus not be
accelerated.

Fix this by implementing support for these combined filters. The
implementation is quite trivial: when there's a combined filter, we
simply recurse into `filter_bitmap()` for all of the sub-filters.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap.c')
-rw-r--r--pack-bitmap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c
index cd3f5c433e..7ce3ede7e4 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -966,6 +966,16 @@ static int filter_bitmap(struct bitmap_index *bitmap_git,
 		return 0;
 	}
 
+	if (filter->choice == LOFC_COMBINE) {
+		int i;
+		for (i = 0; i < filter->sub_nr; i++) {
+			if (filter_bitmap(bitmap_git, tip_objects, to_filter,
+					  &filter->sub[i]) < 0)
+				return -1;
+		}
+		return 0;
+	}
+
 	/* filter choice not handled */
 	return -1;
 }