t5310: add branch-based checks

The current rev-list tests that check the bitmap data only work on HEAD instead of multiple branches. Expand the test cases to handle both 'master' and 'other' branches. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Dec 8, 2020 at 17:04 UTC 1467b9572aa57c1369aaac897fcbbddde4080d75
1 file changed +34 -27
t/t5310-pack-bitmaps.sh
+34 -27
@@ -42,63 +42,70 @@ test_expect_success 'rev-list --test-bitmap verifies bitmaps' '
42 git rev-list --test-bitmap HEAD
43 '
44
45 -rev_list_tests() {
46 - state=$1
47 -
48 - test_expect_success "counting commits via bitmap ($state)" '
49 - git rev-list --count HEAD >expect &&
50 - git rev-list --use-bitmap-index --count HEAD >actual &&
45 +rev_list_tests_head () {
46 + test_expect_success "counting commits via bitmap ($state, $branch)" '
47 + git rev-list --count $branch >expect &&
48 + git rev-list --use-bitmap-index --count $branch >actual &&
49 test_cmp expect actual
50 '
51
54 - test_expect_success "counting partial commits via bitmap ($state)" '
55 - git rev-list --count HEAD~5..HEAD >expect &&
56 - git rev-list --use-bitmap-index --count HEAD~5..HEAD >actual &&
52 + test_expect_success "counting partial commits via bitmap ($state, $branch)" '
53 + git rev-list --count $branch~5..$branch >expect &&
54 + git rev-list --use-bitmap-index --count $branch~5..$branch >actual &&
55 test_cmp expect actual
56 '
57
60 - test_expect_success "counting commits with limit ($state)" '
61 - git rev-list --count -n 1 HEAD >expect &&
62 - git rev-list --use-bitmap-index --count -n 1 HEAD >actual &&
58 + test_expect_success "counting commits with limit ($state, $branch)" '
59 + git rev-list --count -n 1 $branch >expect &&
60 + git rev-list --use-bitmap-index --count -n 1 $branch >actual &&
61 test_cmp expect actual
62 '
63
66 - test_expect_success "counting non-linear history ($state)" '
64 + test_expect_success "counting non-linear history ($state, $branch)" '
65 git rev-list --count other...second >expect &&
66 git rev-list --use-bitmap-index --count other...second >actual &&
67 test_cmp expect actual
68 '
69
72 - test_expect_success "counting commits with limiting ($state)" '
73 - git rev-list --count HEAD -- 1.t >expect &&
74 - git rev-list --use-bitmap-index --count HEAD -- 1.t >actual &&
70 + test_expect_success "counting commits with limiting ($state, $branch)" '
71 + git rev-list --count $branch -- 1.t >expect &&
72 + git rev-list --use-bitmap-index --count $branch -- 1.t >actual &&
73 test_cmp expect actual
74 '
75
78 - test_expect_success "counting objects via bitmap ($state)" '
79 - git rev-list --count --objects HEAD >expect &&
80 - git rev-list --use-bitmap-index --count --objects HEAD >actual &&
76 + test_expect_success "counting objects via bitmap ($state, $branch)" '
77 + git rev-list --count --objects $branch >expect &&
78 + git rev-list --use-bitmap-index --count --objects $branch >actual &&
79 test_cmp expect actual
80 '
81
84 - test_expect_success "enumerate commits ($state)" '
85 - git rev-list --use-bitmap-index HEAD >actual &&
86 - git rev-list HEAD >expect &&
82 + test_expect_success "enumerate commits ($state, $branch)" '
83 + git rev-list --use-bitmap-index $branch >actual &&
84 + git rev-list $branch >expect &&
85 test_bitmap_traversal --no-confirm-bitmaps expect actual
86 '
87
90 - test_expect_success "enumerate --objects ($state)" '
91 - git rev-list --objects --use-bitmap-index HEAD >actual &&
92 - git rev-list --objects HEAD >expect &&
88 + test_expect_success "enumerate --objects ($state, $branch)" '
89 + git rev-list --objects --use-bitmap-index $branch >actual &&
90 + git rev-list --objects $branch >expect &&
91 test_bitmap_traversal expect actual
92 '
93
96 - test_expect_success "bitmap --objects handles non-commit objects ($state)" '
97 - git rev-list --objects --use-bitmap-index HEAD tagged-blob >actual &&
94 + test_expect_success "bitmap --objects handles non-commit objects ($state, $branch)" '
95 + git rev-list --objects --use-bitmap-index $branch tagged-blob >actual &&
96 grep $blob actual
97 '
98 }
99
100 +rev_list_tests () {
101 + state=$1
102 +
103 + for branch in "second" "other"
104 + do
105 + rev_list_tests_head
106 + done
107 +}
108 +
109 rev_list_tests 'full bitmap'
110
111 test_expect_success 'clone from bitmapped repository' '