3 test_description
='exercise basic bitmap functionality'
6 test_expect_success
'setup repo with moderate-sized history' '
7 for i in $(test_seq 1 10); do
10 git checkout -b other HEAD~5 &&
11 for i in $(test_seq 1 10); do
14 git checkout master &&
15 blob=$(echo tagged-blob | git hash-object -w --stdin) &&
16 git tag tagged-blob $blob &&
17 git config pack.writebitmaps true
20 test_expect_success
'full repack creates bitmaps' '
22 ls .git/objects/pack/ | grep bitmap >output &&
23 test_line_count = 1 output
26 test_expect_success
'rev-list --test-bitmap verifies bitmaps' '
27 git rev-list --test-bitmap HEAD
33 test_expect_success
"counting commits via bitmap ($state)" '
34 git rev-list --count HEAD >expect &&
35 git rev-list --use-bitmap-index --count HEAD >actual &&
36 test_cmp expect actual
39 test_expect_success
"counting partial commits via bitmap ($state)" '
40 git rev-list --count HEAD~5..HEAD >expect &&
41 git rev-list --use-bitmap-index --count HEAD~5..HEAD >actual &&
42 test_cmp expect actual
45 test_expect_success
"counting non-linear history ($state)" '
46 git rev-list --count other...master >expect &&
47 git rev-list --use-bitmap-index --count other...master >actual &&
48 test_cmp expect actual
51 test_expect_success
"enumerate --objects ($state)" '
52 git rev-list --objects --use-bitmap-index HEAD >tmp &&
53 cut -d" " -f1 <tmp >tmp2 &&
55 git rev-list --objects HEAD >tmp &&
56 cut -d" " -f1 <tmp >tmp2 &&
58 test_cmp expect actual
61 test_expect_success
"bitmap --objects handles non-commit objects ($state)" '
62 git rev-list --objects --use-bitmap-index HEAD tagged-blob >actual &&
67 rev_list_tests
'full bitmap'
69 test_expect_success
'clone from bitmapped repository' '
70 git clone --no-local --bare . clone.git &&
71 git rev-parse HEAD >expect &&
72 git --git-dir=clone.git rev-parse HEAD >actual &&
73 test_cmp expect actual
76 test_expect_success
'setup further non-bitmapped commits' '
77 for i in $(test_seq 1 10); do
78 test_commit further-$i
82 rev_list_tests
'partial bitmap'
84 test_expect_success
'fetch (partial bitmap)' '
85 git --git-dir=clone.git fetch origin master:master &&
86 git rev-parse HEAD >expect &&
87 git --git-dir=clone.git rev-parse HEAD >actual &&
88 test_cmp expect actual
91 test_expect_success
'incremental repack cannot create bitmaps' '
93 test_must_fail git repack -d
96 test_expect_success
'incremental repack can disable bitmaps' '
98 git repack -d --no-write-bitmap-index
101 test_expect_success
'full repack, reusing previous bitmaps' '
103 ls .git/objects/pack/ | grep bitmap >output &&
104 test_line_count = 1 output
107 test_expect_success
'fetch (full bitmap)' '
108 git --git-dir=clone.git fetch origin master:master &&
109 git rev-parse HEAD >expect &&
110 git --git-dir=clone.git rev-parse HEAD >actual &&
111 test_cmp expect actual
114 test_lazy_prereq JGIT
'
118 test_expect_success JGIT
'we can read jgit bitmaps' '
119 git clone . compat-jgit &&
122 rm -f .git/objects/pack/*.bitmap &&
124 git rev-list --test-bitmap HEAD
128 test_expect_success JGIT
'jgit can read our bitmaps' '
129 git clone . compat-us &&
133 # jgit gc will barf if it does not like our bitmaps