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>
Patrick Steinhardt committed
Apr 19, 2021 at 13:47 UTC
169a15ebd66dd23bf8c379ad33bced1578c848ef
2 files changed
+17
pack-bitmap.c
+10
@@ -966,6 +966,16 @@ static int filter_bitmap(struct bitmap_index *bitmap_git,
966
return 0;
967
}
968
969
+ if (filter->choice == LOFC_COMBINE) {
970
+ int i;
971
+ for (i = 0; i < filter->sub_nr; i++) {
972
+ if (filter_bitmap(bitmap_git, tip_objects, to_filter,
973
+ &filter->sub[i]) < 0)
974
+ return -1;
975
+ }
976
+ return 0;
977
+ }
978
+
979
/* filter choice not handled */
980
return -1;
981
}
t/t6113-rev-list-bitmap-filters.sh
+7
@@ -98,4 +98,11 @@ test_expect_success 'object:type filter' '
98
test_bitmap_traversal expect actual
99
'
100
101
+test_expect_success 'combine filter' '
102
+ git rev-list --objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect &&
103
+ git rev-list --use-bitmap-index \
104
+ --objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual &&
105
+ test_bitmap_traversal expect actual
106
+'
107
+
108
test_done