Subject: Re: [PATCH v8 09/10] grep: simplify config parsing and option parsing

From: Junio C Hamano <[email-masked]>
Date: Tue, 18 Jan 2022 14:55:17 -0800

Junio C Hamano <[email-masked]> writes:

>> @@ -56,17 +62,22 @@ int grep_config(const char *var, const char *value, void *cb)
>>  {
>>  	struct grep_opt *opt = cb;
>>  	const char *slot;
>> +	static int ero = -1;
>
> Is this new reentrancy issue worth it?  I think it makes the whole
> thing unnecessarily complex, compared to a more naïve "we keep track
> of the last-one-that-won for grep.extendedRegexp and
> grep.patternType separately during option and config parsing inside
> the grep_opt structure, and then combine the two when we compile the
> pattern string into regexp or pcre object" approach.

Another problem is that there are those corporate server-side folks
who are interested in giving an endpoint that lets clients to ask
performing Git operations (like grep and blame).  Adding more statics
instead of keeping track of dynamic runtime structure like grep_opt
is deliberately making things more difficult for them, isn't it?