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 &&
18 git config pack.writebitmaphashcache true
21 test_expect_success
'full repack creates bitmaps' '
23 ls .git/objects/pack/ | grep bitmap >output &&
24 test_line_count = 1 output
27 test_expect_success
'rev-list --test-bitmap verifies bitmaps' '
28 git rev-list --test-bitmap HEAD
34 test_expect_success
"counting commits via bitmap ($state)" '
35 git rev-list --count HEAD >expect &&
36 git rev-list --use-bitmap-index --count HEAD >actual &&
37 test_cmp expect actual
40 test_expect_success
"counting partial commits via bitmap ($state)" '
41 git rev-list --count HEAD~5..HEAD >expect &&
42 git rev-list --use-bitmap-index --count HEAD~5..HEAD >actual &&
43 test_cmp expect actual
46 test_expect_success
"counting non-linear history ($state)" '
47 git rev-list --count other...master >expect &&
48 git rev-list --use-bitmap-index --count other...master >actual &&
49 test_cmp expect actual
52 test_expect_success
"enumerate --objects ($state)" '
53 git rev-list --objects --use-bitmap-index HEAD >tmp &&
54 cut -d" " -f1 <tmp >tmp2 &&
56 git rev-list --objects HEAD >tmp &&
57 cut -d" " -f1 <tmp >tmp2 &&
59 test_cmp expect actual
62 test_expect_success
"bitmap --objects handles non-commit objects ($state)" '
63 git rev-list --objects --use-bitmap-index HEAD tagged-blob >actual &&
68 rev_list_tests
'full bitmap'
70 test_expect_success
'clone from bitmapped repository' '
71 git clone --no-local --bare . clone.git &&
72 git rev-parse HEAD >expect &&
73 git --git-dir=clone.git rev-parse HEAD >actual &&
74 test_cmp expect actual
77 test_expect_success
'setup further non-bitmapped commits' '
78 for i in $(test_seq 1 10); do
79 test_commit further-$i
83 rev_list_tests
'partial bitmap'
85 test_expect_success
'fetch (partial bitmap)' '
86 git --git-dir=clone.git fetch origin master:master &&
87 git rev-parse HEAD >expect &&
88 git --git-dir=clone.git rev-parse HEAD >actual &&
89 test_cmp expect actual
92 test_expect_success
'incremental repack cannot create bitmaps' '
94 test_must_fail git repack -d
97 test_expect_success
'incremental repack can disable bitmaps' '
99 git repack -d --no-write-bitmap-index
102 test_expect_success
'full repack, reusing previous bitmaps' '
104 ls .git/objects/pack/ | grep bitmap >output &&
105 test_line_count = 1 output
108 test_expect_success
'fetch (full bitmap)' '
109 git --git-dir=clone.git fetch origin master:master &&
110 git rev-parse HEAD >expect &&
111 git --git-dir=clone.git rev-parse HEAD >actual &&
112 test_cmp expect actual
115 test_lazy_prereq JGIT
'
119 test_expect_success JGIT
'we can read jgit bitmaps' '
120 git clone . compat-jgit &&
123 rm -f .git/objects/pack/*.bitmap &&
125 git rev-list --test-bitmap HEAD
129 test_expect_success JGIT
'jgit can read our bitmaps' '
130 git clone . compat-us &&
134 # jgit gc will barf if it does not like our bitmaps