Re: git-prompt.sh incompatible with non-basic global grep.patternType
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 22, 2016, 19:51 UTC
- Message-ID
- <xmqqa8h9a1uj.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160722192811.GA18079@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
>> This comes from b22520a3 (grep: allow -E and -n to be turned on by >> default via configuration, 2011-03-30) back when we didn't have a >> more generic grep.patternType configuration mechanism in v1.7.5 >> days, and it probably need to be deprecated to maintain our sanity. >> ... > I am not even sure we need to deprecate it. Once it becomes merely a > historical synonym for "grep.patternType=extended" we can live with it > indefinitely (and I do not think we need a deprecation period to go > there; the existing behavior is simply buggy).
I grossed over an important detail.
Pretending as if grep.patternType=extended were given when we see grep.extendedregexp=true and grep.patternType=basic is given when grep.extendedregexp=false changes the behaviour in a way that can be seen as the violation of (crazy) expectations t7810 makes.
Any user who depends on that crazy expectation will be broken by such a change, even if we do not deprecate and remove the configuration variable.
grep.c | 4 ++-- grep.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/grep.c b/grep.c index 394c856..7b1d423 100644 --- a/grep.c +++ b/grep.c @@ -73,9 +73,9 @@ int grep_config(const char *var, const char *value, void *cb) if (!strcmp(var, "grep.extendedregexp")) { if (git_config_bool(var, value)) - opt->extended_regexp_option = 1; + opt->pattern_type_option = GREP_PATTERN_ERE; else - opt->extended_regexp_option = 0; + opt->pattern_type_option = GREP_PATTERN_BRE; return 0; } diff --git a/grep.h b/grep.h index cee4357..fc36c2a 100644 --- a/grep.h +++ b/grep.h @@ -119,7 +119,6 @@ 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];