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