Merge branch 'cm/rebase-i-fixup-amend-reword'
[git] / t / t6113-rev-list-bitmap-filters.sh
1 #!/bin/sh
2
3 test_description='rev-list combining bitmaps and filters'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-bitmap.sh
6
7 test_expect_success 'set up bitmapped repo' '
8         # one commit will have bitmaps, the other will not
9         test_commit one &&
10         test_commit much-larger-blob-one &&
11         git repack -adb &&
12         test_commit two &&
13         test_commit much-larger-blob-two
14 '
15
16 test_expect_success 'filters fallback to non-bitmap traversal' '
17         # use a path-based filter, since they are inherently incompatible with
18         # bitmaps (i.e., this test will never get confused by later code to
19         # combine the features)
20         filter=$(echo "!one" | git hash-object -w --stdin) &&
21         git rev-list --objects --filter=sparse:oid=$filter HEAD >expect &&
22         git rev-list --use-bitmap-index \
23                      --objects --filter=sparse:oid=$filter HEAD >actual &&
24         test_cmp expect actual
25 '
26
27 test_expect_success 'blob:none filter' '
28         git rev-list --objects --filter=blob:none HEAD >expect &&
29         git rev-list --use-bitmap-index \
30                      --objects --filter=blob:none HEAD >actual &&
31         test_bitmap_traversal expect actual
32 '
33
34 test_expect_success 'blob:none filter with specified blob' '
35         git rev-list --objects --filter=blob:none HEAD HEAD:two.t >expect &&
36         git rev-list --use-bitmap-index \
37                      --objects --filter=blob:none HEAD HEAD:two.t >actual &&
38         test_bitmap_traversal expect actual
39 '
40
41 test_expect_success 'blob:limit filter' '
42         git rev-list --objects --filter=blob:limit=5 HEAD >expect &&
43         git rev-list --use-bitmap-index \
44                      --objects --filter=blob:limit=5 HEAD >actual &&
45         test_bitmap_traversal expect actual
46 '
47
48 test_expect_success 'blob:limit filter with specified blob' '
49         git rev-list --objects --filter=blob:limit=5 \
50                      HEAD HEAD:much-larger-blob-two.t >expect &&
51         git rev-list --use-bitmap-index \
52                      --objects --filter=blob:limit=5 \
53                      HEAD HEAD:much-larger-blob-two.t >actual &&
54         test_bitmap_traversal expect actual
55 '
56
57 test_expect_success 'tree:0 filter' '
58         git rev-list --objects --filter=tree:0 HEAD >expect &&
59         git rev-list --use-bitmap-index \
60                      --objects --filter=tree:0 HEAD >actual &&
61         test_bitmap_traversal expect actual
62 '
63
64 test_expect_success 'tree:0 filter with specified blob, tree' '
65         git rev-list --objects --filter=tree:0 HEAD HEAD:two.t >expect &&
66         git rev-list --use-bitmap-index \
67                      --objects --filter=tree:0 HEAD HEAD:two.t >actual &&
68         test_bitmap_traversal expect actual
69 '
70
71 test_expect_success 'tree:1 filter' '
72         git rev-list --objects --filter=tree:1 HEAD >expect &&
73         git rev-list --use-bitmap-index \
74                      --objects --filter=tree:1 HEAD >actual &&
75         test_cmp expect actual
76 '
77
78 test_done