t / perf / p1451-fsck-skip-list.shon commit Merge branch 'bc/sha-256' (33e4ae9)
   1#!/bin/sh
   2
   3test_description='Test fsck skipList performance'
   4
   5. ./perf-lib.sh
   6
   7test_perf_fresh_repo
   8
   9n=1000000
  10
  11test_expect_success "setup $n bad commits" '
  12        for i in $(test_seq 1 $n)
  13        do
  14                echo "commit refs/heads/master" &&
  15                echo "committer C <c@example.com> 1234567890 +0000" &&
  16                echo "data <<EOF" &&
  17                echo "$i.Q." &&
  18                echo "EOF"
  19        done | q_to_nul | git fast-import
  20'
  21
  22skip=0
  23while test $skip -le $n
  24do
  25        test_expect_success "create skipList for $skip bad commits" '
  26                git log --format=%H --max-count=$skip |
  27                sort >skiplist
  28        '
  29
  30        test_perf "fsck with $skip skipped bad commits" '
  31                git -c fsck.skipList=skiplist fsck
  32        '
  33
  34        case $skip in
  35        0) skip=1 ;;
  36        *) skip=${skip}0 ;;
  37        esac
  38done
  39
  40test_done