mirror of
https://github.com/git/git
synced 2024-09-12 21:04:12 +00:00
4f3bd5606a
We can easily support BLOB_NONE filters with bitmaps. Since we know the types of all of the objects, we just need to clear the result bits of any blobs. Note two subtleties in the implementation (which I also called out in comments): - we have to include any blobs that were specifically asked for (and not reached through graph traversal) to match the non-bitmap version - we have to handle in-pack and "ext_index" objects separately. Arguably prepare_bitmap_walk() could be adding these ext_index objects to the type bitmaps. But it doesn't for now, so let's match the rest of the bitmap code here (it probably wouldn't be an efficiency improvement to do so since the cost of extending those bitmaps is about the same as our loop here, but it might make the code a bit simpler). Here are perf results for the new test on git.git: Test HEAD^ HEAD -------------------------------------------------------------------------------- 5310.9: rev-list count with blob:none 1.67(1.62+0.05) 0.22(0.21+0.02) -86.8% Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
39 lines
1.2 KiB
Bash
Executable file
39 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='rev-list combining bitmaps and filters'
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'set up bitmapped repo' '
|
|
# one commit will have bitmaps, the other will not
|
|
test_commit one &&
|
|
git repack -adb &&
|
|
test_commit two
|
|
'
|
|
|
|
test_expect_success 'filters fallback to non-bitmap traversal' '
|
|
# use a path-based filter, since they are inherently incompatible with
|
|
# bitmaps (i.e., this test will never get confused by later code to
|
|
# combine the features)
|
|
filter=$(echo "!one" | git hash-object -w --stdin) &&
|
|
git rev-list --objects --filter=sparse:oid=$filter HEAD >expect &&
|
|
git rev-list --use-bitmap-index \
|
|
--objects --filter=sparse:oid=$filter HEAD >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'blob:none filter' '
|
|
git rev-list --objects --filter=blob:none HEAD >expect &&
|
|
git rev-list --use-bitmap-index \
|
|
--objects --filter=blob:none HEAD >actual &&
|
|
test_bitmap_traversal expect actual
|
|
'
|
|
|
|
test_expect_success 'blob:none filter with specified blob' '
|
|
git rev-list --objects --filter=blob:none HEAD HEAD:two.t >expect &&
|
|
git rev-list --use-bitmap-index \
|
|
--objects --filter=blob:none HEAD HEAD:two.t >actual &&
|
|
test_bitmap_traversal expect actual
|
|
'
|
|
|
|
test_done
|