]>
Commit | Line | Data |
---|---|---|
e03f928e JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='rev-list combining bitmaps and filters' | |
4 | . ./test-lib.sh | |
ddfe9006 | 5 | . "$TEST_DIRECTORY"/lib-bitmap.sh |
e03f928e JK |
6 | |
7 | test_expect_success 'set up bitmapped repo' ' | |
8 | # one commit will have bitmaps, the other will not | |
9 | test_commit one && | |
84243da1 | 10 | test_commit much-larger-blob-one && |
e03f928e | 11 | git repack -adb && |
84243da1 | 12 | test_commit two && |
7ab6aafa PS |
13 | test_commit much-larger-blob-two && |
14 | git tag tag | |
e03f928e JK |
15 | ' |
16 | ||
17 | test_expect_success 'filters fallback to non-bitmap traversal' ' | |
18 | # use a path-based filter, since they are inherently incompatible with | |
19 | # bitmaps (i.e., this test will never get confused by later code to | |
20 | # combine the features) | |
21 | filter=$(echo "!one" | git hash-object -w --stdin) && | |
22 | git rev-list --objects --filter=sparse:oid=$filter HEAD >expect && | |
23 | git rev-list --use-bitmap-index \ | |
24 | --objects --filter=sparse:oid=$filter HEAD >actual && | |
25 | test_cmp expect actual | |
26 | ' | |
27 | ||
4f3bd560 JK |
28 | test_expect_success 'blob:none filter' ' |
29 | git rev-list --objects --filter=blob:none HEAD >expect && | |
30 | git rev-list --use-bitmap-index \ | |
31 | --objects --filter=blob:none HEAD >actual && | |
32 | test_bitmap_traversal expect actual | |
33 | ' | |
34 | ||
35 | test_expect_success 'blob:none filter with specified blob' ' | |
36 | git rev-list --objects --filter=blob:none HEAD HEAD:two.t >expect && | |
37 | git rev-list --use-bitmap-index \ | |
38 | --objects --filter=blob:none HEAD HEAD:two.t >actual && | |
39 | test_bitmap_traversal expect actual | |
40 | ' | |
41 | ||
84243da1 JK |
42 | test_expect_success 'blob:limit filter' ' |
43 | git rev-list --objects --filter=blob:limit=5 HEAD >expect && | |
44 | git rev-list --use-bitmap-index \ | |
45 | --objects --filter=blob:limit=5 HEAD >actual && | |
46 | test_bitmap_traversal expect actual | |
47 | ' | |
48 | ||
49 | test_expect_success 'blob:limit filter with specified blob' ' | |
50 | git rev-list --objects --filter=blob:limit=5 \ | |
51 | HEAD HEAD:much-larger-blob-two.t >expect && | |
52 | git rev-list --use-bitmap-index \ | |
53 | --objects --filter=blob:limit=5 \ | |
54 | HEAD HEAD:much-larger-blob-two.t >actual && | |
55 | test_bitmap_traversal expect actual | |
56 | ' | |
57 | ||
b0a8d482 TB |
58 | test_expect_success 'tree:0 filter' ' |
59 | git rev-list --objects --filter=tree:0 HEAD >expect && | |
60 | git rev-list --use-bitmap-index \ | |
61 | --objects --filter=tree:0 HEAD >actual && | |
62 | test_bitmap_traversal expect actual | |
63 | ' | |
64 | ||
65 | test_expect_success 'tree:0 filter with specified blob, tree' ' | |
66 | git rev-list --objects --filter=tree:0 HEAD HEAD:two.t >expect && | |
67 | git rev-list --use-bitmap-index \ | |
68 | --objects --filter=tree:0 HEAD HEAD:two.t >actual && | |
69 | test_bitmap_traversal expect actual | |
70 | ' | |
71 | ||
72 | test_expect_success 'tree:1 filter' ' | |
73 | git rev-list --objects --filter=tree:1 HEAD >expect && | |
74 | git rev-list --use-bitmap-index \ | |
75 | --objects --filter=tree:1 HEAD >actual && | |
76 | test_cmp expect actual | |
77 | ' | |
78 | ||
7ab6aafa PS |
79 | test_expect_success 'object:type filter' ' |
80 | git rev-list --objects --filter=object:type=tag tag >expect && | |
81 | git rev-list --use-bitmap-index \ | |
82 | --objects --filter=object:type=tag tag >actual && | |
83 | test_cmp expect actual && | |
84 | ||
85 | git rev-list --objects --filter=object:type=commit tag >expect && | |
86 | git rev-list --use-bitmap-index \ | |
87 | --objects --filter=object:type=commit tag >actual && | |
88 | test_bitmap_traversal expect actual && | |
89 | ||
90 | git rev-list --objects --filter=object:type=tree tag >expect && | |
91 | git rev-list --use-bitmap-index \ | |
92 | --objects --filter=object:type=tree tag >actual && | |
93 | test_bitmap_traversal expect actual && | |
94 | ||
95 | git rev-list --objects --filter=object:type=blob tag >expect && | |
96 | git rev-list --use-bitmap-index \ | |
97 | --objects --filter=object:type=blob tag >actual && | |
98 | test_bitmap_traversal expect actual | |
99 | ' | |
100 | ||
9cf68b27 PS |
101 | test_expect_success 'object:type filter with --filter-provided-objects' ' |
102 | git rev-list --objects --filter-provided-objects --filter=object:type=tag tag >expect && | |
103 | git rev-list --use-bitmap-index \ | |
104 | --objects --filter-provided-objects --filter=object:type=tag tag >actual && | |
105 | test_cmp expect actual && | |
106 | ||
107 | git rev-list --objects --filter-provided-objects --filter=object:type=commit tag >expect && | |
108 | git rev-list --use-bitmap-index \ | |
109 | --objects --filter-provided-objects --filter=object:type=commit tag >actual && | |
110 | test_bitmap_traversal expect actual && | |
111 | ||
112 | git rev-list --objects --filter-provided-objects --filter=object:type=tree tag >expect && | |
113 | git rev-list --use-bitmap-index \ | |
114 | --objects --filter-provided-objects --filter=object:type=tree tag >actual && | |
115 | test_bitmap_traversal expect actual && | |
116 | ||
117 | git rev-list --objects --filter-provided-objects --filter=object:type=blob tag >expect && | |
118 | git rev-list --use-bitmap-index \ | |
119 | --objects --filter-provided-objects --filter=object:type=blob tag >actual && | |
120 | test_bitmap_traversal expect actual | |
121 | ' | |
122 | ||
169a15eb PS |
123 | test_expect_success 'combine filter' ' |
124 | git rev-list --objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect && | |
125 | git rev-list --use-bitmap-index \ | |
126 | --objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual && | |
127 | test_bitmap_traversal expect actual | |
128 | ' | |
129 | ||
9cf68b27 PS |
130 | test_expect_success 'combine filter with --filter-provided-objects' ' |
131 | git rev-list --objects --filter-provided-objects --filter=blob:limit=1000 --filter=object:type=blob tag >expect && | |
132 | git rev-list --use-bitmap-index \ | |
133 | --objects --filter-provided-objects --filter=blob:limit=1000 --filter=object:type=blob tag >actual && | |
134 | test_bitmap_traversal expect actual && | |
135 | ||
136 | git cat-file --batch-check="%(objecttype) %(objectsize)" <actual >objects && | |
137 | while read objecttype objectsize | |
138 | do | |
139 | test "$objecttype" = blob || return 1 | |
140 | test "$objectsize" -le 1000 || return 1 | |
141 | done <objects | |
142 | ' | |
143 | ||
7b3c8e9f TB |
144 | test_expect_success 'bitmap traversal with --unpacked' ' |
145 | git repack -adb && | |
146 | test_commit unpacked && | |
147 | ||
148 | git rev-list --objects --no-object-names unpacked^.. >expect.raw && | |
149 | sort expect.raw >expect && | |
150 | ||
151 | git rev-list --use-bitmap-index --objects --all --unpacked >actual.raw && | |
152 | sort actual.raw >actual && | |
153 | ||
154 | test_cmp expect actual | |
155 | ' | |
156 | ||
e03f928e | 157 | test_done |