]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t6113-rev-list-bitmap-filters.sh
Merge branch 'vd/fsck-submodule-url-test'
[thirdparty/git.git] / t / t6113-rev-list-bitmap-filters.sh
index 3f889949ca14dc77eb6b39e5246bea3fe6823fd8..459f0d741225522276b84a9a65caaa2e2a985bde 100755 (executable)
@@ -4,13 +4,16 @@ test_description='rev-list combining bitmaps and filters'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-bitmap.sh
 
+TEST_PASSES_SANITIZE_LEAK=true
+
 test_expect_success 'set up bitmapped repo' '
        # one commit will have bitmaps, the other will not
        test_commit one &&
        test_commit much-larger-blob-one &&
        git repack -adb &&
        test_commit two &&
-       test_commit much-larger-blob-two
+       test_commit much-larger-blob-two &&
+       git tag tag
 '
 
 test_expect_success 'filters fallback to non-bitmap traversal' '
@@ -75,4 +78,82 @@ test_expect_success 'tree:1 filter' '
        test_cmp expect actual
 '
 
+test_expect_success 'object:type filter' '
+       git rev-list --objects --filter=object:type=tag tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter=object:type=tag tag >actual &&
+       test_cmp expect actual &&
+
+       git rev-list --objects --filter=object:type=commit tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter=object:type=commit tag >actual &&
+       test_bitmap_traversal expect actual &&
+
+       git rev-list --objects --filter=object:type=tree tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter=object:type=tree tag >actual &&
+       test_bitmap_traversal expect actual &&
+
+       git rev-list --objects --filter=object:type=blob tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter=object:type=blob tag >actual &&
+       test_bitmap_traversal expect actual
+'
+
+test_expect_success 'object:type filter with --filter-provided-objects' '
+       git rev-list --objects --filter-provided-objects --filter=object:type=tag tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter-provided-objects --filter=object:type=tag tag >actual &&
+       test_cmp expect actual &&
+
+       git rev-list --objects --filter-provided-objects --filter=object:type=commit tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter-provided-objects --filter=object:type=commit tag >actual &&
+       test_bitmap_traversal expect actual &&
+
+       git rev-list --objects --filter-provided-objects --filter=object:type=tree tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter-provided-objects --filter=object:type=tree tag >actual &&
+       test_bitmap_traversal expect actual &&
+
+       git rev-list --objects --filter-provided-objects --filter=object:type=blob tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter-provided-objects --filter=object:type=blob tag >actual &&
+       test_bitmap_traversal expect actual
+'
+
+test_expect_success 'combine filter' '
+       git rev-list --objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual &&
+       test_bitmap_traversal expect actual
+'
+
+test_expect_success 'combine filter with --filter-provided-objects' '
+       git rev-list --objects --filter-provided-objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect &&
+       git rev-list --use-bitmap-index \
+                    --objects --filter-provided-objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual &&
+       test_bitmap_traversal expect actual &&
+
+       git cat-file --batch-check="%(objecttype) %(objectsize)" <actual >objects &&
+       while read objecttype objectsize
+       do
+               test "$objecttype" = blob || return 1
+               test "$objectsize" -le 1000 || return 1
+       done <objects
+'
+
+test_expect_success 'bitmap traversal with --unpacked' '
+       git repack -adb &&
+       test_commit unpacked &&
+
+       git rev-list --objects --no-object-names unpacked^.. >expect.raw &&
+       sort expect.raw >expect &&
+
+       git rev-list --use-bitmap-index --objects --all --unpacked >actual.raw &&
+       sort actual.raw >actual &&
+
+       test_cmp expect actual
+'
+
 test_done