Merge branch 'maint'
[git] / t / perf / p5310-pack-bitmaps.sh
1 #!/bin/sh
2
3 test_description='Tests pack performance using bitmaps'
4 . ./perf-lib.sh
5
6 test_perf_large_repo
7
8 # note that we do everything through config,
9 # since we want to be able to compare bitmap-aware
10 # git versus non-bitmap git
11 test_expect_success 'setup bitmap config' '
12         git config pack.writebitmaps true &&
13         git config pack.writebitmaphashcache true
14 '
15
16 test_perf 'repack to disk' '
17         git repack -ad
18 '
19
20 test_perf 'simulated clone' '
21         git pack-objects --stdout --all </dev/null >/dev/null
22 '
23
24 test_perf 'simulated fetch' '
25         have=$(git rev-list HEAD~100 -1) &&
26         {
27                 echo HEAD &&
28                 echo ^$have
29         } | git pack-objects --revs --stdout >/dev/null
30 '
31
32 test_expect_success 'create partial bitmap state' '
33         # pick a commit to represent the repo tip in the past
34         cutoff=$(git rev-list HEAD~100 -1) &&
35         orig_tip=$(git rev-parse HEAD) &&
36
37         # now kill off all of the refs and pretend we had
38         # just the one tip
39         rm -rf .git/logs .git/refs/* .git/packed-refs
40         git update-ref HEAD $cutoff
41
42         # and then repack, which will leave us with a nice
43         # big bitmap pack of the "old" history, and all of
44         # the new history will be loose, as if it had been pushed
45         # up incrementally and exploded via unpack-objects
46         git repack -Ad
47
48         # and now restore our original tip, as if the pushes
49         # had happened
50         git update-ref HEAD $orig_tip
51 '
52
53 test_perf 'partial bitmap' '
54         git pack-objects --stdout --all </dev/null >/dev/null
55 '
56
57 test_done