Merge branch 'main' of github.com:git/git
[alt-git.git] / t / perf / p5326-multi-pack-bitmaps.sh
blobd082e6cacbeb344e405f9da7ca86065c8cf2d0c4
1 #!/bin/sh
3 test_description='Tests performance using midx bitmaps'
4 . ./perf-lib.sh
5 . "${TEST_DIRECTORY}/perf/lib-bitmap.sh"
7 test_bitmap () {
8 local enabled="$1"
10 test_expect_success "remove existing repo (lookup=$enabled)" '
11 rm -fr * .git
14 test_perf_large_repo
16 # we need to create the tag up front such that it is covered by the repack and
17 # thus by generated bitmaps.
18 test_expect_success 'create tags' '
19 git tag --message="tag pointing to HEAD" perf-tag HEAD
22 test_expect_success "use lookup table: $enabled" '
23 git config pack.writeBitmapLookupTable '"$enabled"'
26 test_expect_success "start with bitmapped pack (lookup=$enabled)" '
27 git repack -adb
30 test_perf "setup multi-pack index (lookup=$enabled)" '
31 git multi-pack-index write --bitmap
34 test_expect_success "drop pack bitmap (lookup=$enabled)" '
35 rm -f .git/objects/pack/pack-*.bitmap
38 test_full_bitmap
40 test_expect_success "create partial bitmap state (lookup=$enabled)" '
41 # pick a commit to represent the repo tip in the past
42 cutoff=$(git rev-list HEAD~100 -1) &&
43 orig_tip=$(git rev-parse HEAD) &&
45 # now pretend we have just one tip
46 rm -rf .git/logs .git/refs/* .git/packed-refs &&
47 git update-ref HEAD $cutoff &&
49 # and then repack, which will leave us with a nice
50 # big bitmap pack of the "old" history, and all of
51 # the new history will be loose, as if it had been pushed
52 # up incrementally and exploded via unpack-objects
53 git repack -Ad &&
54 git multi-pack-index write --bitmap &&
56 # and now restore our original tip, as if the pushes
57 # had happened
58 git update-ref HEAD $orig_tip
61 test_partial_bitmap
64 test_bitmap false
65 test_bitmap true
67 test_done