path: root/t/
diff options
authorJunio C Hamano <>2016-07-22 18:43:14 (GMT)
committerJunio C Hamano <>2016-07-25 16:16:18 (GMT)
commit8465541e8ce8eaf16e66ab847086779768c18f2d (patch)
tree07a499721a46f259d2da05d1d6654e39211c657f /t/
parent765428699a5381f113d19974720bc91b5bfeaf1d (diff)
grep: further simplify setting the pattern type
When c5c31d33 (grep: move pattern-type bits support to top-level grep.[ch], 2012-10-03) introduced grep_commit_pattern_type() helper function, the intention was to allow the users of grep API to having to fiddle only with .pattern_type_option (which can be set to "fixed", "basic", "extended", and "pcre"), and then immediately before compiling the pattern strings for use, call grep_commit_pattern_type() to have it prepare various bits in the grep_opt structure (like .fixed, .regflags, etc.). However, grep_set_pattern_type_option() helper function the grep API internally uses were left as an external function by mistake. This function shouldn't have been made callable by the users of the API. Later when the grep API was used in revision traversal machinery, the caller then mistakenly started calling the function around 34a4ae55 (log --grep: use the same helper to set -E/-F options as "git grep", 2012-10-03), instead of setting the .pattern_type_option field and letting the grep_commit_pattern_type() to take care of the details. This caused an unnecessary bug that made a configured grep.patternType take precedence over the command line options (e.g. --basic-regexp, --fixed-strings) in "git log" family of commands. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 14 insertions, 0 deletions
diff --git a/t/ b/t/
index 1b2e981..f136a0f 100755
--- a/t/
+++ b/t/
@@ -232,6 +232,20 @@ test_expect_success 'log -F -E --grep=<ere> uses ere' '
test_cmp expect actual
+test_expect_success 'log with grep.patternType configuration' '
+ >expect &&
+ git -c grep.patterntype=fixed \
+ log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
+ test_cmp expect actual
+test_expect_success 'log with grep.patternType configuration and command line' '
+ echo second >expect &&
+ git -c grep.patterntype=fixed \
+ log -1 --pretty=tformat:%s --basic-regexp --grep=s.c.nd >actual &&
+ test_cmp expect actual
cat > expect <<EOF
* Second
* sixth