t / perf / p5310-pack-bitmaps.shon commit Merge branch 'dl/branch-from-3dot-merge-base' (4ac8371)
   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
  11#
  12# We intentionally use the deprecated pack.writebitmaps
  13# config so that we can test against older versions of git.
  14test_expect_success 'setup bitmap config' '
  15        git config pack.writebitmaps true
  16'
  17
  18test_perf 'repack to disk' '
  19        git repack -ad
  20'
  21
  22test_perf 'simulated clone' '
  23        git pack-objects --stdout --all </dev/null >/dev/null
  24'
  25
  26test_perf 'simulated fetch' '
  27        have=$(git rev-list HEAD~100 -1) &&
  28        {
  29                echo HEAD &&
  30                echo ^$have
  31        } | git pack-objects --revs --stdout >/dev/null
  32'
  33
  34test_perf 'pack to file' '
  35        git pack-objects --all pack1 </dev/null >/dev/null
  36'
  37
  38test_perf 'pack to file (bitmap)' '
  39        git pack-objects --use-bitmap-index --all pack1b </dev/null >/dev/null
  40'
  41
  42test_expect_success 'create partial bitmap state' '
  43        # pick a commit to represent the repo tip in the past
  44        cutoff=$(git rev-list HEAD~100 -1) &&
  45        orig_tip=$(git rev-parse HEAD) &&
  46
  47        # now kill off all of the refs and pretend we had
  48        # just the one tip
  49        rm -rf .git/logs .git/refs/* .git/packed-refs &&
  50        git update-ref HEAD $cutoff &&
  51
  52        # and then repack, which will leave us with a nice
  53        # big bitmap pack of the "old" history, and all of
  54        # the new history will be loose, as if it had been pushed
  55        # up incrementally and exploded via unpack-objects
  56        git repack -Ad &&
  57
  58        # and now restore our original tip, as if the pushes
  59        # had happened
  60        git update-ref HEAD $orig_tip
  61'
  62
  63test_perf 'clone (partial bitmap)' '
  64        git pack-objects --stdout --all </dev/null >/dev/null
  65'
  66
  67test_perf 'pack to file (partial bitmap)' '
  68        git pack-objects --use-bitmap-index --all pack2b </dev/null >/dev/null
  69'
  70
  71test_done