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

Re: git grep -F (fixed string) requires matching parenthesis?

From
Nnanaya <edho@fastmail.com>
Date
Aug 13, 2019, 12:33 UTC
Message-ID
<11796f65-42ec-4a0b-b1b1-a693f8eb3cf9@www.fastmail.com>
In-Reply-To
<20190813121733.GA10787@sigill.intra.peff.net>
On Tue, Aug 13, 2019, at 21:17, Jeff King wrote:
Show 16 quoted lines
> But I think it's actually happening at a level above that. git-grep
> supports multiple patterns, which can be joined with --and, --or, --not,
> etc. And they can be grouped with parentheses.
> 
> What you're seeing is the argument parser thinking your '(' is part of
> the construction of a boolean match formula, and complaining about the
> lack of closing ')'. You can use "-e" to make it clear that it's a
> pattern (just as you'd need to for a pattern that starts with "-"):
> 
>   git grep -F -e '('
> 
> So I think everything is working as designed, though I admit the
> implication was slightly surprising to me (and note that it only happens
> with that _specific_ pattern; something like "(foo" would not be matched
> by the option parser).
> 
Thanks. That was confusing (and the error message didn't help). I've always assumed the grep is similar to posix grep so it was weird the same syntax work for fgrep but not git-grep -F.
Previous: Jeff King
Message 3 of 3 in “git grep -F (fixed string) requires matching parenthesis?”
  1. nanayaAug 13, 2019
  2. Jeff KingAug 13, 2019
  3. nanayaAug 13, 2019

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.