Merge branch 'mb/reword-autocomplete-message' into 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 #
12 # We intentionally use the deprecated pack.writebitmaps
13 # config so that we can test against older versions of git.
14 test_expect_success 'setup bitmap config' '
15         git config pack.writebitmaps true &&
16         git config pack.writebitmaphashcache true
17 '
18
19 test_perf 'repack to disk' '
20         git repack -ad
21 '
22
23 test_perf 'simulated clone' '
24         git pack-objects --stdout --all </dev/null >/dev/null
25 '
26
27 test_perf 'simulated fetch' '
28         have=$(git rev-list HEAD~100 -1) &&
29         {
30                 echo HEAD &&
31                 echo ^$have
32         } | git pack-objects --revs --stdout >/dev/null
33 '
34
35 test_perf 'pack to file' '
36         git pack-objects --all pack1 </dev/null >/dev/null
37 '
38
39 test_perf 'pack to file (bitmap)' '
40         git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
41 '
42
43 test_expect_success 'create partial bitmap state' '
44         # pick a commit to represent the repo tip in the past
45         cutoff=$(git rev-list HEAD~100 -1) &&
46         orig_tip=$(git rev-parse HEAD) &&
47
48         # now kill off all of the refs and pretend we had
49         # just the one tip
50         rm -rf .git/logs .git/refs/* .git/packed-refs &&
51         git update-ref HEAD $cutoff &&
52
53         # and then repack, which will leave us with a nice
54         # big bitmap pack of the "old" history, and all of
55         # the new history will be loose, as if it had been pushed
56         # up incrementally and exploded via unpack-objects
57         git repack -Ad &&
58
59         # and now restore our original tip, as if the pushes
60         # had happened
61         git update-ref HEAD $orig_tip
62 '
63
64 test_perf 'clone (partial bitmap)' '
65         git pack-objects --stdout --all </dev/null >/dev/null
66 '
67
68 test_perf 'pack to file (partial bitmap)' '
69         git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
70 '
71
72 test_done