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

Re: git-grep: option parsing conflicts with prefix-dash searches

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 6, 2010, 04:53 UTC
Message-ID
<7v7hqrdkxb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100206035143.GA31784@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> The worst I could come up with is the
> double-double-dash case:
>
>   git grep -- pattern revision -- pathname
>
> It is perhaps not as pretty as
>
>   git grep -e pattern revision -- pathname
>
> but I don't think it is ambiguous.
I don't think if "ambiguous or not" is what we are after to begin with.

I have known GNU extended grep implementations long enough but never saw that "--" used to quote a pattern. Is it worth supporting to begin with?

Show 6 quoted lines
> So actually my patch above is breaking somebody who truly wanted to grep
> for "--" by doing
>
>   git grep --
>
> but that is sufficiently insane that I'm not too worried about it.

I would say "git grep -- pattern" is sufficiently insane enough that I'm not worried about it at all. Interpreting "git grep --" as a request to look for double-dash feels million times saner than that, actually.

Unless somebody comes up with example of that pattern's wide use. Point me to some well known open source software's source trees that use "--" for such a purpose in one of its shell script or Makefile.

Previous: Jeff KingNext: Miles Bader
Message 7 of 12 in “git-grep: option parsing conflicts with prefix-dash searches”
  1. Jan EngelhardtFeb 5, 2010
  2. Jan EngelhardtFeb 5, 2010
  3. Santi BéjarFeb 5, 2010
  4. Junio C HamanoFeb 5, 2010
  5. Junio C HamanoFeb 5, 2010
  6. Jeff KingFeb 6, 2010
  7. Junio C HamanoFeb 6, 2010
  8. Miles BaderFeb 6, 2010
  9. Jeff KingFeb 6, 2010
  10. Junio C HamanoFeb 6, 2010
  11. Jeff KingFeb 7, 2010
  12. Junio C HamanoFeb 8, 2010

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.