completion: fix incorrect bash/zsh string equality check
[git/debian.git] / t / t6113-rev-list-bitmap-filters.sh
blob4d8e09167e78d078a6c14e7d51e3a9cb0aa7bf89
1 #!/bin/sh
3 test_description='rev-list combining bitmaps and filters'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-bitmap.sh
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 git tag tag
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
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
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
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
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
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
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
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
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 &&
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 &&
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 &&
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
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 &&
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 &&
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 &&
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
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
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 &&
136 git cat-file --batch-check="%(objecttype) %(objectsize)" <actual >objects &&
137 while read objecttype objectsize
139 test "$objecttype" = blob || return 1
140 test "$objectsize" -le 1000 || return 1
141 done <objects
144 test_done