Browse Source
The internal implementation of "git grep" has seen some clean-up. * ab/grep-preparatory-cleanup: (31 commits) grep: assert that threading is enabled when calling grep_{lock,unlock} grep: given --threads with NO_PTHREADS=YesPlease, warn pack-objects: fix buggy warning about threads pack-objects & index-pack: add test for --threads warning test-lib: add a PTHREADS prerequisite grep: move is_fixed() earlier to avoid forward declaration grep: change internal *pcre* variable & function names to be *pcre1* grep: change the internal PCRE macro names to be PCRE1 grep: factor test for \0 in grep patterns into a function grep: remove redundant regflags assignments grep: catch a missing enum in switch statement perf: add a comparison test of log --grep regex engines with -F perf: add a comparison test of log --grep regex engines perf: add a comparison test of grep regex engines with -F perf: add a comparison test of grep regex engines perf: emit progress output when unpacking & building perf: add a GIT_PERF_MAKE_COMMAND for when *_MAKE_OPTS won't do grep: add tests to fix blind spots with \0 patterns grep: prepare for testing binary regexes containing rx metacharacters grep: add a test helper function for less verbose -f \0 tests ...maint
![gitster@pobox.com](/assets/img/avatar_default.png)
24 changed files with 843 additions and 239 deletions
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description="Comparison of git-log's --grep regex engines |
||||
|
||||
Set GIT_PERF_4220_LOG_OPTS in the environment to pass options to |
||||
git-grep. Make sure to include a leading space, |
||||
e.g. GIT_PERF_4220_LOG_OPTS=' -i'. Some options to try: |
||||
|
||||
-i |
||||
--invert-grep |
||||
-i --invert-grep |
||||
" |
||||
|
||||
. ./perf-lib.sh |
||||
|
||||
test_perf_large_repo |
||||
test_checkout_worktree |
||||
|
||||
for pattern in \ |
||||
'how.to' \ |
||||
'^how to' \ |
||||
'[how] to' \ |
||||
'\(e.t[^ ]*\|v.ry\) rare' \ |
||||
'm\(ú\|u\)lt.b\(æ\|y\)te' |
||||
do |
||||
for engine in basic extended perl |
||||
do |
||||
if test $engine != "basic" |
||||
then |
||||
# Poor man's basic -> extended converter. |
||||
pattern=$(echo $pattern | sed 's/\\//g') |
||||
fi |
||||
if test $engine = "perl" && ! test_have_prereq PCRE |
||||
then |
||||
prereq="PCRE" |
||||
else |
||||
prereq="" |
||||
fi |
||||
test_perf $prereq "$engine log$GIT_PERF_4220_LOG_OPTS --grep='$pattern'" " |
||||
git -c grep.patternType=$engine log --pretty=format:%h$GIT_PERF_4220_LOG_OPTS --grep='$pattern' >'out.$engine' || : |
||||
" |
||||
done |
||||
|
||||
test_expect_success "assert that all engines found the same for$GIT_PERF_4220_LOG_OPTS '$pattern'" ' |
||||
test_cmp out.basic out.extended && |
||||
if test_have_prereq PCRE |
||||
then |
||||
test_cmp out.basic out.perl |
||||
fi |
||||
' |
||||
done |
||||
|
||||
test_done |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description="Comparison of git-log's --grep regex engines with -F |
||||
|
||||
Set GIT_PERF_4221_LOG_OPTS in the environment to pass options to |
||||
git-grep. Make sure to include a leading space, |
||||
e.g. GIT_PERF_4221_LOG_OPTS=' -i'. Some options to try: |
||||
|
||||
-i |
||||
--invert-grep |
||||
-i --invert-grep |
||||
" |
||||
|
||||
. ./perf-lib.sh |
||||
|
||||
test_perf_large_repo |
||||
test_checkout_worktree |
||||
|
||||
for pattern in 'int' 'uncommon' 'æ' |
||||
do |
||||
for engine in fixed basic extended perl |
||||
do |
||||
if test $engine = "perl" && ! test_have_prereq PCRE |
||||
then |
||||
prereq="PCRE" |
||||
else |
||||
prereq="" |
||||
fi |
||||
test_perf $prereq "$engine log$GIT_PERF_4221_LOG_OPTS --grep='$pattern'" " |
||||
git -c grep.patternType=$engine log --pretty=format:%h$GIT_PERF_4221_LOG_OPTS --grep='$pattern' >'out.$engine' || : |
||||
" |
||||
done |
||||
|
||||
test_expect_success "assert that all engines found the same for$GIT_PERF_4221_LOG_OPTS '$pattern'" ' |
||||
test_cmp out.fixed out.basic && |
||||
test_cmp out.fixed out.extended && |
||||
if test_have_prereq PCRE |
||||
then |
||||
test_cmp out.fixed out.perl |
||||
fi |
||||
' |
||||
done |
||||
|
||||
test_done |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description="Comparison of git-grep's regex engines |
||||
|
||||
Set GIT_PERF_7820_GREP_OPTS in the environment to pass options to |
||||
git-grep. Make sure to include a leading space, |
||||
e.g. GIT_PERF_7820_GREP_OPTS=' -i'. Some options to try: |
||||
|
||||
-i |
||||
-w |
||||
-v |
||||
-vi |
||||
-vw |
||||
-viw |
||||
" |
||||
|
||||
. ./perf-lib.sh |
||||
|
||||
test_perf_large_repo |
||||
test_checkout_worktree |
||||
|
||||
for pattern in \ |
||||
'how.to' \ |
||||
'^how to' \ |
||||
'[how] to' \ |
||||
'\(e.t[^ ]*\|v.ry\) rare' \ |
||||
'm\(ú\|u\)lt.b\(æ\|y\)te' |
||||
do |
||||
for engine in basic extended perl |
||||
do |
||||
if test $engine != "basic" |
||||
then |
||||
# Poor man's basic -> extended converter. |
||||
pattern=$(echo "$pattern" | sed 's/\\//g') |
||||
fi |
||||
if test $engine = "perl" && ! test_have_prereq PCRE |
||||
then |
||||
prereq="PCRE" |
||||
else |
||||
prereq="" |
||||
fi |
||||
test_perf $prereq "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern'" " |
||||
git -c grep.patternType=$engine grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine' || : |
||||
" |
||||
done |
||||
|
||||
test_expect_success "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern'" ' |
||||
test_cmp out.basic out.extended && |
||||
if test_have_prereq PCRE |
||||
then |
||||
test_cmp out.basic out.perl |
||||
fi |
||||
' |
||||
done |
||||
|
||||
test_done |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description="Comparison of git-grep's regex engines with -F |
||||
|
||||
Set GIT_PERF_7821_GREP_OPTS in the environment to pass options to |
||||
git-grep. Make sure to include a leading space, |
||||
e.g. GIT_PERF_7821_GREP_OPTS=' -w'. See p7820-grep-engines.sh for more |
||||
options to try. |
||||
" |
||||
|
||||
. ./perf-lib.sh |
||||
|
||||
test_perf_large_repo |
||||
test_checkout_worktree |
||||
|
||||
for pattern in 'int' 'uncommon' 'æ' |
||||
do |
||||
for engine in fixed basic extended perl |
||||
do |
||||
if test $engine = "perl" && ! test_have_prereq PCRE |
||||
then |
||||
prereq="PCRE" |
||||
else |
||||
prereq="" |
||||
fi |
||||
test_perf $prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" " |
||||
git -c grep.patternType=$engine grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine' || : |
||||
" |
||||
done |
||||
|
||||
test_expect_success "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS $pattern" ' |
||||
test_cmp out.fixed out.basic && |
||||
test_cmp out.fixed out.extended && |
||||
if test_have_prereq PCRE |
||||
then |
||||
test_cmp out.fixed out.perl |
||||
fi |
||||
' |
||||
done |
||||
|
||||
test_done |
Loading…
Reference in new issue