Merge branch 'fc/completion-updates' into maint
[git/debian.git] / t / perf / p5310-pack-bitmaps.sh
blob452be01056c6b4797958809036811984634ace7d
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 # we need to create the tag up front such that it is covered by the repack and
19 # thus by generated bitmaps.
20 test_expect_success 'create tags' '
21 git tag --message="tag pointing to HEAD" perf-tag HEAD
24 test_perf 'repack to disk' '
25 git repack -ad
28 test_perf 'simulated clone' '
29 git pack-objects --stdout --all </dev/null >/dev/null
32 test_perf 'simulated fetch' '
33 have=$(git rev-list HEAD~100 -1) &&
35 echo HEAD &&
36 echo ^$have
37 } | git pack-objects --revs --stdout >/dev/null
40 test_perf 'pack to file (bitmap)' '
41 git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
44 test_perf 'rev-list (commits)' '
45 git rev-list --all --use-bitmap-index >/dev/null
48 test_perf 'rev-list (objects)' '
49 git rev-list --all --use-bitmap-index --objects >/dev/null
52 test_perf 'rev-list with tag negated via --not --all (objects)' '
53 git rev-list perf-tag --not --all --use-bitmap-index --objects >/dev/null
56 test_perf 'rev-list with negative tag (objects)' '
57 git rev-list HEAD --not perf-tag --use-bitmap-index --objects >/dev/null
60 test_perf 'rev-list count with blob:none' '
61 git rev-list --use-bitmap-index --count --objects --all \
62 --filter=blob:none >/dev/null
65 test_perf 'rev-list count with blob:limit=1k' '
66 git rev-list --use-bitmap-index --count --objects --all \
67 --filter=blob:limit=1k >/dev/null
70 test_perf 'rev-list count with tree:0' '
71 git rev-list --use-bitmap-index --count --objects --all \
72 --filter=tree:0 >/dev/null
75 test_perf 'simulated partial clone' '
76 git pack-objects --stdout --all --filter=blob:none </dev/null >/dev/null
79 test_expect_success 'create partial bitmap state' '
80 # pick a commit to represent the repo tip in the past
81 cutoff=$(git rev-list HEAD~100 -1) &&
82 orig_tip=$(git rev-parse HEAD) &&
84 # now kill off all of the refs and pretend we had
85 # just the one tip
86 rm -rf .git/logs .git/refs/* .git/packed-refs &&
87 git update-ref HEAD $cutoff &&
89 # and then repack, which will leave us with a nice
90 # big bitmap pack of the "old" history, and all of
91 # the new history will be loose, as if it had been pushed
92 # up incrementally and exploded via unpack-objects
93 git repack -Ad &&
95 # and now restore our original tip, as if the pushes
96 # had happened
97 git update-ref HEAD $orig_tip
100 test_perf 'clone (partial bitmap)' '
101 git pack-objects --stdout --all </dev/null >/dev/null
104 test_perf 'pack to file (partial bitmap)' '
105 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
108 test_perf 'rev-list with tree filter (partial bitmap)' '
109 git rev-list --use-bitmap-index --count --objects --all \
110 --filter=tree:0 >/dev/null
113 test_done