t / perf / p4221-log-grep-engines-fixed.shon commit Merge branch 'rs/apply-validate-input' (53ee6b8)
   1#!/bin/sh
   2
   3test_description="Comparison of git-log's --grep regex engines with -F
   4
   5Set GIT_PERF_4221_LOG_OPTS in the environment to pass options to
   6git-grep. Make sure to include a leading space,
   7e.g. GIT_PERF_4221_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 'int' 'uncommon' 'æ'
  20do
  21        for engine in fixed basic extended perl
  22        do
  23                if test $engine = "perl" && ! test_have_prereq PCRE
  24                then
  25                        prereq="PCRE"
  26                else
  27                        prereq=""
  28                fi
  29                test_perf $prereq "$engine log$GIT_PERF_4221_LOG_OPTS --grep='$pattern'" "
  30                        git -c grep.patternType=$engine log --pretty=format:%h$GIT_PERF_4221_LOG_OPTS --grep='$pattern' >'out.$engine' || :
  31                "
  32        done
  33
  34        test_expect_success "assert that all engines found the same for$GIT_PERF_4221_LOG_OPTS '$pattern'" '
  35                test_cmp out.fixed out.basic &&
  36                test_cmp out.fixed out.extended &&
  37                if test_have_prereq PCRE
  38                then
  39                        test_cmp out.fixed out.perl
  40                fi
  41        '
  42done
  43
  44test_done