t / perf / p5310-pack-bitmaps.shon commit t/perf: add tests for pack bitmaps (bbcefa1)
   1#!/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
  11test_expect_success 'setup bitmap config' '
  12        git config pack.writebitmaps true
  13'
  14
  15test_perf 'repack to disk' '
  16        git repack -ad
  17'
  18
  19test_perf 'simulated clone' '
  20        git pack-objects --stdout --all </dev/null >/dev/null
  21'
  22
  23test_perf 'simulated fetch' '
  24        have=$(git rev-list HEAD~100 -1) &&
  25        {
  26                echo HEAD &&
  27                echo ^$have
  28        } | git pack-objects --revs --stdout >/dev/null
  29'
  30
  31test_expect_success 'create partial bitmap state' '
  32        # pick a commit to represent the repo tip in the past
  33        cutoff=$(git rev-list HEAD~100 -1) &&
  34        orig_tip=$(git rev-parse HEAD) &&
  35
  36        # now kill off all of the refs and pretend we had
  37        # just the one tip
  38        rm -rf .git/logs .git/refs/* .git/packed-refs
  39        git update-ref HEAD $cutoff
  40
  41        # and then repack, which will leave us with a nice
  42        # big bitmap pack of the "old" history, and all of
  43        # the new history will be loose, as if it had been pushed
  44        # up incrementally and exploded via unpack-objects
  45        git repack -Ad
  46
  47        # and now restore our original tip, as if the pushes
  48        # had happened
  49        git update-ref HEAD $orig_tip
  50'
  51
  52test_perf 'partial bitmap' '
  53        git pack-objects --stdout --all </dev/null >/dev/null
  54'
  55
  56test_done