| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='Tests performance using midx bitmaps' |
| 4 | . ./perf-lib.sh |
| 5 | . "${TEST_DIRECTORY}/perf/lib-bitmap.sh" |
| 6 | |
| 7 | test_bitmap () { |
| 8 | local enabled="$1" |
| 9 | |
| 10 | test_expect_success "remove existing repo (lookup=$enabled)" ' |
| 11 | rm -fr * .git |
| 12 | ' |
| 13 | |
| 14 | test_perf_large_repo |
| 15 | |
| 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 |
| 20 | ' |
| 21 | |
| 22 | test_expect_success "use lookup table: $enabled" ' |
| 23 | git config pack.writeBitmapLookupTable '"$enabled"' |
| 24 | ' |
| 25 | |
| 26 | test_expect_success "start with bitmapped pack (lookup=$enabled)" ' |
| 27 | git repack -adb |
| 28 | ' |
| 29 | |
| 30 | test_perf "setup multi-pack index (lookup=$enabled)" ' |
| 31 | git multi-pack-index write --bitmap |
| 32 | ' |
| 33 | |
| 34 | test_expect_success "drop pack bitmap (lookup=$enabled)" ' |
| 35 | rm -f .git/objects/pack/pack-*.bitmap |
| 36 | ' |
| 37 | |
| 38 | test_full_bitmap |
| 39 | |
| 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) && |
| 44 | |
| 45 | # now pretend we have just one tip |
| 46 | rm -rf .git/logs .git/refs/* .git/packed-refs && |
| 47 | git update-ref HEAD $cutoff && |
| 48 | |
| 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 && |
| 55 | |
| 56 | # and now restore our original tip, as if the pushes |
| 57 | # had happened |
| 58 | git update-ref HEAD $orig_tip |
| 59 | ' |
| 60 | |
| 61 | test_partial_bitmap |
| 62 | } |
| 63 | |
| 64 | test_bitmap false |
| 65 | test_bitmap true |
| 66 | |
| 67 | test_done |