]> git.ipfire.org Git - thirdparty/git.git/blame - t/perf/p5310-pack-bitmaps.sh
pack-objects: default to writing bitmap hash-cache
[thirdparty/git.git] / t / perf / p5310-pack-bitmaps.sh
CommitLineData
bbcefa1f
JK
1#!/bin/sh
2
3test_description='Tests pack performance using bitmaps'
4. ./perf-lib.sh
5
6test_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
71d76cb4
JK
11#
12# We intentionally use the deprecated pack.writebitmaps
13# config so that we can test against older versions of git.
bbcefa1f 14test_expect_success 'setup bitmap config' '
d4316604 15 git config pack.writebitmaps true
bbcefa1f
JK
16'
17
18test_perf 'repack to disk' '
19 git repack -ad
20'
21
22test_perf 'simulated clone' '
23 git pack-objects --stdout --all </dev/null >/dev/null
24'
25
26test_perf 'simulated fetch' '
27 have=$(git rev-list HEAD~100 -1) &&
28 {
29 echo HEAD &&
30 echo ^$have
31 } | git pack-objects --revs --stdout >/dev/null
32'
33
645c432d
KS
34test_perf 'pack to file' '
35 git pack-objects --all pack1 </dev/null >/dev/null
36'
37
38test_perf 'pack to file (bitmap)' '
39 git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
40'
41
bbcefa1f
JK
42test_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) &&
46
47 # now kill off all of the refs and pretend we had
48 # just the one tip
5330e6e2
SB
49 rm -rf .git/logs .git/refs/* .git/packed-refs &&
50 git update-ref HEAD $cutoff &&
bbcefa1f
JK
51
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
5330e6e2 56 git repack -Ad &&
bbcefa1f
JK
57
58 # and now restore our original tip, as if the pushes
59 # had happened
60 git update-ref HEAD $orig_tip
61'
62
645c432d 63test_perf 'clone (partial bitmap)' '
bbcefa1f
JK
64 git pack-objects --stdout --all </dev/null >/dev/null
65'
66
645c432d
KS
67test_perf 'pack to file (partial bitmap)' '
68 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
69'
70
bbcefa1f 71test_done