t/t3*: avoid redundant uses of cat
[alt-git.git] / t / t6113-rev-list-bitmap-filters.sh
bloba9656a1ec8a6d71814a5f17157eb0e2acbd4bf98
1 #!/bin/sh
3 test_description='rev-list combining bitmaps and filters'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-bitmap.sh
10 test_expect_success 'set up bitmapped repo' '
11 # one commit will have bitmaps, the other will not
12 test_commit one &&
13 test_commit much-larger-blob-one &&
14 git repack -adb &&
15 test_commit two &&
16 test_commit much-larger-blob-two &&
17 git tag tag
20 test_expect_success 'filters fallback to non-bitmap traversal' '
21 # use a path-based filter, since they are inherently incompatible with
22 # bitmaps (i.e., this test will never get confused by later code to
23 # combine the features)
24 filter=$(echo "!one" | git hash-object -w --stdin) &&
25 git rev-list --objects --filter=sparse:oid=$filter HEAD >expect &&
26 git rev-list --use-bitmap-index \
27 --objects --filter=sparse:oid=$filter HEAD >actual &&
28 test_cmp expect actual
31 test_expect_success 'blob:none filter' '
32 git rev-list --objects --filter=blob:none HEAD >expect &&
33 git rev-list --use-bitmap-index \
34 --objects --filter=blob:none HEAD >actual &&
35 test_bitmap_traversal expect actual
38 test_expect_success 'blob:none filter with specified blob' '
39 git rev-list --objects --filter=blob:none HEAD HEAD:two.t >expect &&
40 git rev-list --use-bitmap-index \
41 --objects --filter=blob:none HEAD HEAD:two.t >actual &&
42 test_bitmap_traversal expect actual
45 test_expect_success 'blob:limit filter' '
46 git rev-list --objects --filter=blob:limit=5 HEAD >expect &&
47 git rev-list --use-bitmap-index \
48 --objects --filter=blob:limit=5 HEAD >actual &&
49 test_bitmap_traversal expect actual
52 test_expect_success 'blob:limit filter with specified blob' '
53 git rev-list --objects --filter=blob:limit=5 \
54 HEAD HEAD:much-larger-blob-two.t >expect &&
55 git rev-list --use-bitmap-index \
56 --objects --filter=blob:limit=5 \
57 HEAD HEAD:much-larger-blob-two.t >actual &&
58 test_bitmap_traversal expect actual
61 test_expect_success 'tree:0 filter' '
62 git rev-list --objects --filter=tree:0 HEAD >expect &&
63 git rev-list --use-bitmap-index \
64 --objects --filter=tree:0 HEAD >actual &&
65 test_bitmap_traversal expect actual
68 test_expect_success 'tree:0 filter with specified blob, tree' '
69 git rev-list --objects --filter=tree:0 HEAD HEAD:two.t >expect &&
70 git rev-list --use-bitmap-index \
71 --objects --filter=tree:0 HEAD HEAD:two.t >actual &&
72 test_bitmap_traversal expect actual
75 test_expect_success 'tree:1 filter' '
76 git rev-list --objects --filter=tree:1 HEAD >expect &&
77 git rev-list --use-bitmap-index \
78 --objects --filter=tree:1 HEAD >actual &&
79 test_cmp expect actual
82 test_expect_success 'object:type filter' '
83 git rev-list --objects --filter=object:type=tag tag >expect &&
84 git rev-list --use-bitmap-index \
85 --objects --filter=object:type=tag tag >actual &&
86 test_cmp expect actual &&
88 git rev-list --objects --filter=object:type=commit tag >expect &&
89 git rev-list --use-bitmap-index \
90 --objects --filter=object:type=commit tag >actual &&
91 test_bitmap_traversal expect actual &&
93 git rev-list --objects --filter=object:type=tree tag >expect &&
94 git rev-list --use-bitmap-index \
95 --objects --filter=object:type=tree tag >actual &&
96 test_bitmap_traversal expect actual &&
98 git rev-list --objects --filter=object:type=blob tag >expect &&
99 git rev-list --use-bitmap-index \
100 --objects --filter=object:type=blob tag >actual &&
101 test_bitmap_traversal expect actual
104 test_expect_success 'object:type filter with --filter-provided-objects' '
105 git rev-list --objects --filter-provided-objects --filter=object:type=tag tag >expect &&
106 git rev-list --use-bitmap-index \
107 --objects --filter-provided-objects --filter=object:type=tag tag >actual &&
108 test_cmp expect actual &&
110 git rev-list --objects --filter-provided-objects --filter=object:type=commit tag >expect &&
111 git rev-list --use-bitmap-index \
112 --objects --filter-provided-objects --filter=object:type=commit tag >actual &&
113 test_bitmap_traversal expect actual &&
115 git rev-list --objects --filter-provided-objects --filter=object:type=tree tag >expect &&
116 git rev-list --use-bitmap-index \
117 --objects --filter-provided-objects --filter=object:type=tree tag >actual &&
118 test_bitmap_traversal expect actual &&
120 git rev-list --objects --filter-provided-objects --filter=object:type=blob tag >expect &&
121 git rev-list --use-bitmap-index \
122 --objects --filter-provided-objects --filter=object:type=blob tag >actual &&
123 test_bitmap_traversal expect actual
126 test_expect_success 'combine filter' '
127 git rev-list --objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect &&
128 git rev-list --use-bitmap-index \
129 --objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual &&
130 test_bitmap_traversal expect actual
133 test_expect_success 'combine filter with --filter-provided-objects' '
134 git rev-list --objects --filter-provided-objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect &&
135 git rev-list --use-bitmap-index \
136 --objects --filter-provided-objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual &&
137 test_bitmap_traversal expect actual &&
139 git cat-file --batch-check="%(objecttype) %(objectsize)" <actual >objects &&
140 while read objecttype objectsize
142 test "$objecttype" = blob || return 1
143 test "$objectsize" -le 1000 || return 1
144 done <objects
147 test_expect_success 'bitmap traversal with --unpacked' '
148 git repack -adb &&
149 test_commit unpacked &&
151 git rev-list --objects --no-object-names unpacked^.. >expect.raw &&
152 sort expect.raw >expect &&
154 git rev-list --use-bitmap-index --objects --all --unpacked >actual.raw &&
155 sort actual.raw >actual &&
157 test_cmp expect actual
160 test_done