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

Re: [PATCH 3/3] grep: support newline separated pattern list

From
Junio C Hamano <gitster@pobox.com>
Date
May 20, 2012, 22:29 UTC
Message-ID
<7vobpia3l3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4FB900A3.9050309@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 9 quoted lines
> Currently, patterns that contain newline characters don't match anything
> when given to git grep.  Regular grep(1) interprets patterns as lists of
> newline separated search strings instead.
>
> Implement this functionality by creating and inserting extra grep_pat
> structures for patterns consisting of multiple lines when appending to
> the pattern lists.  For simplicity, all pattern strings are duplicated.
> The original pattern is truncated in place to make it contain only the
> first line.

Thanks for a fix; I am assuming that the duplication for simplicity is not for simplified allocation but primarily for a simpler freeing?

Previous: René ScharfeNext: René Scharfe
Message 7 of 8 in “git grep -F doesn't behave like grep -F?”
  1. Torne (Richard Coles)May 18, 2012
  2. René ScharfeMay 18, 2012
  3. Torne (Richard Coles)May 18, 2012
  4. 1/3 grep: factor out create_grep_pat()René Scharfe, May 20, 2012
  5. 2/3 grep: factor out do_append_grep_pat()René Scharfe, May 20, 2012
  6. 3/3 grep: support newline separated pattern listRené Scharfe, May 20, 2012
  7. Junio C HamanoMay 20, 2012
  8. René ScharfeMay 21, 2012

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.