t / perf / p0005-status.shon commit Merge branch 'rs/pretty-add-again' into maint (4977117)
   1#!/bin/sh
   2#
   3# This test measures the performance of various read-tree
   4# and status operations.  It is primarily interested in
   5# the algorithmic costs of index operations and recursive
   6# tree traversal -- and NOT disk I/O on thousands of files.
   7
   8test_description="Tests performance of read-tree"
   9
  10. ./perf-lib.sh
  11
  12test_perf_default_repo
  13
  14# If the test repo was generated by ./repos/many-files.sh
  15# then we know something about the data shape and branches,
  16# so we can isolate testing to the ballast-related commits
  17# and setup sparse-checkout so we don't have to populate
  18# the ballast files and directories.
  19#
  20# Otherwise, we make some general assumptions about the
  21# repo and consider the entire history of the current
  22# branch to be the ballast.
  23
  24test_expect_success "setup repo" '
  25        if git rev-parse --verify refs/heads/p0006-ballast^{commit}
  26        then
  27                echo Assuming synthetic repo from many-files.sh
  28                git branch br_base            master
  29                git branch br_ballast         p0006-ballast
  30                git config --local core.sparsecheckout 1
  31                cat >.git/info/sparse-checkout <<-EOF
  32                /*
  33                !ballast/*
  34                EOF
  35        else
  36                echo Assuming non-synthetic repo...
  37                git branch br_base            $(git rev-list HEAD | tail -n 1)
  38                git branch br_ballast         HEAD
  39        fi &&
  40        git checkout -q br_ballast &&
  41        nr_files=$(git ls-files | wc -l)
  42'
  43
  44test_perf "read-tree status br_ballast ($nr_files)" '
  45        git read-tree HEAD &&
  46        git status
  47'
  48
  49test_done