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