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
Junio C Hamano <gitster@pobox.com>
Date
Jul 20, 2016, 20:10 UTC
Message-ID
<xmqqwpkgcbp9.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160720134211.GA19359@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> On Mon, Jul 18, 2016 at 03:56:09PM -0700, Richard Soderberg wrote:
>
>> ps. git log --basic-regexp does not fix the issue, as for unknown
>> reasons (I'll start another thread) the command-line option doesn't
>> override grep.patternType.
>
> Dscho gave a fix for your immediate issue, but this "ps" definitely
> seems like a bug to me. Command-line options should always take
> precedence over config.

This may fix it. I think the root cause is that logic to smear "pattern type" into various broken-down fields in grep_opt for the short-hands like --basic-regexp option needs to leave "I am setting this short-hand" mark to allow the grep_commit_pattern_type() that is done as the final step of the set-up sequence before we call compile_grep_patterns() can take notice. The calls currently made to grep_set_pattern_type_option() when we parse "--basic-regexp" and friends forgets to override the "source of truth" field and only updates the broken-down fields.

An alternative may be to update places that parse "--basic-regexp" and friends to just write to .pattern_type_option without calling grep_set_pattern_type_option(); that might be a cleaner, but I am not feeling well today so I won't be able to do a deeper analysis right now.

 grep.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/grep.c b/grep.c
index 394c856..908ed3d 100644
--- a/grep.c
+++ b/grep.c
@@ -203,6 +203,7 @@ void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct gr
 		opt->regflags &= ~REG_EXTENDED;
 		break;
 	}
+	opt->pattern_type_option = pattern_type;
 }
 
 static struct grep_pat *create_grep_pat(const char *pat, size_t patlen,
Previous: Jeff KingNext: Jeff King
Message 6 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.