t / perf / p4220-log-grep-engines.shon commit Merge branch 'nd/diff-stat-with-summary' (868f7d2)
   1#!/bin/sh
   2
   3test_description="Comparison of git-log's --grep regex engines
   4
   5Set GIT_PERF_4220_LOG_OPTS in the environment to pass options to
   6git-grep. Make sure to include a leading space,
   7e.g. GIT_PERF_4220_LOG_OPTS=' -i'. Some options to try:
   8
   9        -i
  10        --invert-grep
  11        -i --invert-grep
  12"
  13
  14. ./perf-lib.sh
  15
  16test_perf_large_repo
  17test_checkout_worktree
  18
  19for pattern in \
  20        'how.to' \
  21        '^how to' \
  22        '[how] to' \
  23        '\(e.t[^ ]*\|v.ry\) rare' \
  24        'm\(ú\|u\)lt.b\(æ\|y\)te'
  25do
  26        for engine in basic extended perl
  27        do
  28                if test $engine != "basic"
  29                then
  30                        # Poor man's basic -> extended converter.
  31                        pattern=$(echo $pattern | sed 's/\\//g')
  32                fi
  33                if test $engine = "perl" && ! test_have_prereq PCRE
  34                then
  35                        prereq="PCRE"
  36                else
  37                        prereq=""
  38                fi
  39                test_perf $prereq "$engine log$GIT_PERF_4220_LOG_OPTS --grep='$pattern'" "
  40                        git -c grep.patternType=$engine log --pretty=format:%h$GIT_PERF_4220_LOG_OPTS --grep='$pattern' >'out.$engine' || :
  41                "
  42        done
  43
  44        test_expect_success "assert that all engines found the same for$GIT_PERF_4220_LOG_OPTS '$pattern'" '
  45                test_cmp out.basic out.extended &&
  46                if test_have_prereq PCRE
  47                then
  48                        test_cmp out.basic out.perl
  49                fi
  50        '
  51done
  52
  53test_done