1 # Helper functions for testing bitmap performance; see p5310.
4 test_perf
'simulated clone' '
5 git pack-objects --stdout --all </dev/null >/dev/null
8 test_perf
'simulated fetch' '
9 have=$(git rev-list HEAD~100 -1) &&
13 } | git pack-objects --revs --stdout >/dev/null
16 test_perf
'pack to file (bitmap)' '
17 git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
20 test_perf
'rev-list (commits)' '
21 git rev-list --all --use-bitmap-index >/dev/null
24 test_perf
'rev-list (objects)' '
25 git rev-list --all --use-bitmap-index --objects >/dev/null
28 test_perf
'rev-list with tag negated via --not --all (objects)' '
29 git rev-list perf-tag --not --all --use-bitmap-index --objects >/dev/null
32 test_perf
'rev-list with negative tag (objects)' '
33 git rev-list HEAD --not perf-tag --use-bitmap-index --objects >/dev/null
36 test_perf
'rev-list count with blob:none' '
37 git rev-list --use-bitmap-index --count --objects --all \
38 --filter=blob:none >/dev/null
41 test_perf
'rev-list count with blob:limit=1k' '
42 git rev-list --use-bitmap-index --count --objects --all \
43 --filter=blob:limit=1k >/dev/null
46 test_perf
'rev-list count with tree:0' '
47 git rev-list --use-bitmap-index --count --objects --all \
48 --filter=tree:0 >/dev/null
51 test_perf
'simulated partial clone' '
52 git pack-objects --stdout --all --filter=blob:none </dev/null >/dev/null
56 test_partial_bitmap
() {
57 test_perf
'clone (partial bitmap)' '
58 git pack-objects --stdout --all </dev/null >/dev/null
61 test_perf
'pack to file (partial bitmap)' '
62 git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
65 test_perf
'rev-list with tree filter (partial bitmap)' '
66 git rev-list --use-bitmap-index --count --objects --all \
67 --filter=tree:0 >/dev/null
72 test_perf
"repack to disk" '
78 test_expect_success
"create partial bitmap state" '
79 # pick a commit to represent the repo tip in the past
80 cutoff=$(git rev-list HEAD~100 -1) &&
81 orig_tip=$(git rev-parse HEAD) &&
83 # now kill off all of the refs and pretend we had
85 rm -rf .git/logs .git/refs/* .git/packed-refs &&
86 git update-ref HEAD $cutoff &&
88 # and then repack, which will leave us with a nice
89 # big bitmap pack of the "old" history, and all of
90 # the new history will be loose, as if it had been pushed
91 # up incrementally and exploded via unpack-objects
94 # and now restore our original tip, as if the pushes
96 git update-ref HEAD $orig_tip