Git 2.24.4
[git/gitster.git] / t / perf / p5310-pack-bitmaps.sh
blob6a3a42531b056285ac3a42cabe97c41146fa4291
1 #!/bin/sh
3 test_description='Tests pack performance using bitmaps'
4 . ./perf-lib.sh
6 test_perf_large_repo
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
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
18 test_perf 'repack to disk' '
19 git repack -ad
22 test_perf 'simulated clone' '
23 git pack-objects --stdout --all </dev/null >/dev/null
26 test_perf 'simulated fetch' '
27 have=$(git rev-list HEAD~100 -1) &&
29 echo HEAD &&
30 echo ^$have
31 } | git pack-objects --revs --stdout >/dev/null
34 test_perf 'pack to file' '
35 git pack-objects --all pack1 </dev/null >/dev/null
38 test_perf 'pack to file (bitmap)' '
39 git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
42 test_expect_success 'create partial bitmap state' '
43 # pick a commit to represent the repo tip in the past
44 cutoff=$(git rev-list HEAD~100 -1) &&
45 orig_tip=$(git rev-parse HEAD) &&
47 # now kill off all of the refs and pretend we had
48 # just the one tip
49 rm -rf .git/logs .git/refs/* .git/packed-refs &&
50 git update-ref HEAD $cutoff &&
52 # and then repack, which will leave us with a nice
53 # big bitmap pack of the "old" history, and all of
54 # the new history will be loose, as if it had been pushed
55 # up incrementally and exploded via unpack-objects
56 git repack -Ad &&
58 # and now restore our original tip, as if the pushes
59 # had happened
60 git update-ref HEAD $orig_tip
63 test_perf 'clone (partial bitmap)' '
64 git pack-objects --stdout --all </dev/null >/dev/null
67 test_perf 'pack to file (partial bitmap)' '
68 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
71 test_done