Merge branch 'rs/cocci'
[alt-git.git] / t / perf / p5310-pack-bitmaps.sh
blobbb91dbb173dd01bfbfc11f867f0fcfc355db6822
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 &&
16 git config pack.writebitmaphashcache true
19 test_perf 'repack to disk' '
20 git repack -ad
23 test_perf 'simulated clone' '
24 git pack-objects --stdout --all </dev/null >/dev/null
27 test_perf 'simulated fetch' '
28 have=$(git rev-list HEAD~100 -1) &&
30 echo HEAD &&
31 echo ^$have
32 } | git pack-objects --revs --stdout >/dev/null
35 test_perf 'pack to file' '
36 git pack-objects --all pack1 </dev/null >/dev/null
39 test_perf 'pack to file (bitmap)' '
40 git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
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) &&
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 &&
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 &&
59 # and now restore our original tip, as if the pushes
60 # had happened
61 git update-ref HEAD $orig_tip
64 test_perf 'clone (partial bitmap)' '
65 git pack-objects --stdout --all </dev/null >/dev/null
68 test_perf 'pack to file (partial bitmap)' '
69 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
72 test_done