grep: add a grep.patternType configuration setting
The grep.extendedRegexp configuration setting enables the -E flag on grep by default but there are no equivalents for the -G, -F and -P flags. Rather than adding an additional setting for grep.fooRegexp for current and future pattern matching options, add a grep.patternType setting that can accept appropriate values for modifying the default grep pattern matching behavior. The current values are "basic", "extended", "fixed", "perl" and "default" for setting -G, -E, -F, -P and the default behavior respectively. When grep.patternType is set to a value other than "default", the grep.extendedRegexp setting is ignored. The value of "default" restores the current default behavior, including the grep.extendedRegexp behavior. Signed-off-by: J Smith <dark.panda@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
10
grep.h
10
grep.h
@ -58,6 +58,14 @@ enum grep_expr_node {
|
||||
GREP_NODE_OR
|
||||
};
|
||||
|
||||
enum grep_pattern_type {
|
||||
GREP_PATTERN_TYPE_UNSPECIFIED = 0,
|
||||
GREP_PATTERN_TYPE_BRE,
|
||||
GREP_PATTERN_TYPE_ERE,
|
||||
GREP_PATTERN_TYPE_FIXED,
|
||||
GREP_PATTERN_TYPE_PCRE
|
||||
};
|
||||
|
||||
struct grep_expr {
|
||||
enum grep_expr_node node;
|
||||
unsigned hit;
|
||||
@ -103,6 +111,8 @@ struct grep_opt {
|
||||
int max_depth;
|
||||
int funcname;
|
||||
int funcbody;
|
||||
int extended_regexp_option;
|
||||
int pattern_type_option;
|
||||
char color_context[COLOR_MAXLEN];
|
||||
char color_filename[COLOR_MAXLEN];
|
||||
char color_function[COLOR_MAXLEN];
|
||||
|
||||
Reference in New Issue
Block a user