]> git.ipfire.org Git - thirdparty/git.git/blame - t/perf/p5310-pack-bitmaps.sh
Merge branch 'jk/attr-macro-fix'
[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' '
ae4f07fb
VM
15 git config pack.writebitmaps true &&
16 git config pack.writebitmaphashcache true
bbcefa1f
JK
17'
18
19test_perf 'repack to disk' '
20 git repack -ad
21'
22
23test_perf 'simulated clone' '
24 git pack-objects --stdout --all </dev/null >/dev/null
25'
26
27test_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
645c432d
KS
35test_perf 'pack to file' '
36 git pack-objects --all pack1 </dev/null >/dev/null
37'
38
39test_perf 'pack to file (bitmap)' '
40 git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
41'
42
bbcefa1f
JK
43test_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
5330e6e2
SB
50 rm -rf .git/logs .git/refs/* .git/packed-refs &&
51 git update-ref HEAD $cutoff &&
bbcefa1f
JK
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
5330e6e2 57 git repack -Ad &&
bbcefa1f
JK
58
59 # and now restore our original tip, as if the pushes
60 # had happened
61 git update-ref HEAD $orig_tip
62'
63
645c432d 64test_perf 'clone (partial bitmap)' '
bbcefa1f
JK
65 git pack-objects --stdout --all </dev/null >/dev/null
66'
67
645c432d
KS
68test_perf 'pack to file (partial bitmap)' '
69 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
70'
71
bbcefa1f 72test_done