git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-prompt.sh incompatible with non-basic global grep.patternType

From
Jeff King <peff@peff.net>
Date
Jul 22, 2016, 20:05 UTC
Message-ID
<20160722200545.GA18286@sigill.intra.peff.net>
In-Reply-To
<xmqqa8h9a1uj.fsf@gitster.mtv.corp.google.com>
On Fri, Jul 22, 2016 at 12:51:00PM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> >> 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.

Ah. Reading 84befcd (grep: add a grep.patternType configuration setting, 2012-08-03) explains the rules, although I agree they are crazy (mostly because "basic" is different "fixed").

So I think there are two crazy things going on:
  1. grep.extendedregexp takes precedence over the command-line (or at
     least "--basic" on the command line).
  2. The weird rules in 84befcd, where patternType=fixed has higher
     precedence than extendedRegexp, but patternType=basic does not.

It seems like (1) is a bug, and one we should not have to worry about compatibility while fixing. It stems from not telling the difference between "the user asked for nothing, so we defaulted to basic" and "the user explicitly asked for basic".

I think (2) _is_ kind of crazy, and stems from similar confusion. I dunno. Part of me wants to say "I find it highly unlikely that anybody ever actually relied on this, and therefore it is OK to bring it closer to sanity without a deprecation period". But I admit that is just a gut feeling.

But even that is a lesser breakage than taking away grep.extendedRegexp entirely. Taking it away breaks anybody who uses it; tweaking (2) only breaks people who set both config variables. But why would anyone do that?

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 14 in “git-prompt.sh incompatible with non-basic global grep.patternType”
  1. Richard SoderbergJul 18, 2016
  2. Johannes SchindelinJul 19, 2016
  3. Richard SoderbergJul 19, 2016
  4. Johannes SchindelinJul 19, 2016
  5. Jeff KingJul 20, 2016
  6. Junio C HamanoJul 20, 2016
  7. Jeff KingJul 20, 2016
  8. Junio C HamanoJul 22, 2016
  9. Jeff KingJul 22, 2016
  10. Junio C HamanoJul 22, 2016
  11. Jeff KingJul 22, 2016
  12. Junio C HamanoJul 22, 2016
  13. Eric SunshineJul 22, 2016
  14. Junio C HamanoJul 25, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.