blob: bb91dbb173dd01bfbfc11f867f0fcfc355db6822 [file] [log] [blame]
Jeff Kingbbcefa12013-12-21 09:00:42 -05001#!/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
Jeff King71d76cb2014-06-10 16:20:30 -040011#
12# We intentionally use the deprecated pack.writebitmaps
13# config so that we can test against older versions of git.
Jeff Kingbbcefa12013-12-21 09:00:42 -050014test_expect_success 'setup bitmap config' '
Vicent Martiae4f07f2013-12-21 09:00:45 -050015 git config pack.writebitmaps true &&
16 git config pack.writebitmaphashcache true
Jeff Kingbbcefa12013-12-21 09:00:42 -050017'
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
Kirill Smelkov645c4322016-09-10 18:01:44 +030035test_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
Jeff Kingbbcefa12013-12-21 09:00:42 -050043test_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
Stefan Beller5330e6e2015-06-26 14:27:00 -070050 rm -rf .git/logs .git/refs/* .git/packed-refs &&
51 git update-ref HEAD $cutoff &&
Jeff Kingbbcefa12013-12-21 09:00:42 -050052
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
Stefan Beller5330e6e2015-06-26 14:27:00 -070057 git repack -Ad &&
Jeff Kingbbcefa12013-12-21 09:00:42 -050058
59 # and now restore our original tip, as if the pushes
60 # had happened
61 git update-ref HEAD $orig_tip
62'
63
Kirill Smelkov645c4322016-09-10 18:01:44 +030064test_perf 'clone (partial bitmap)' '
Jeff Kingbbcefa12013-12-21 09:00:42 -050065 git pack-objects --stdout --all </dev/null >/dev/null
66'
67
Kirill Smelkov645c4322016-09-10 18:01:44 +030068test_perf 'pack to file (partial bitmap)' '
69 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
70'
71
Jeff Kingbbcefa12013-12-21 09:00:42 -050072test_done