Skip to content

Commit 169a15e

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ab6aaf commit 169a15e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pack-bitmap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,16 @@ static int filter_bitmap(struct bitmap_index *bitmap_git,
966966
return 0;
967967
}
968968

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+
969979
/* filter choice not handled */
970980
return -1;
971981
}

t/t6113-rev-list-bitmap-filters.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,11 @@ test_expect_success 'object:type filter' '
9898
test_bitmap_traversal expect actual
9999
'
100100

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+
101108
test_done

0 commit comments

Comments
 (0)