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

Re: git grep prints colon instead of slash

From
Jeff King <peff@peff.net>
Date
Nov 21, 2018, 13:59 UTC
Message-ID
<20181121135921.GA9586@sigill.intra.peff.net>
In-Reply-To
<5d3618d4-8a5a-b4dc-3cc9-4134cd73675a@free.fr>
On Wed, Nov 21, 2018 at 02:54:34PM +0100, Marc Gonzalez wrote:
Show 20 quoted lines
> If I specify the branch to explore, git grep prints a colon instead of
> a slash in the path:
> 
> $ git grep arm,coresight-tmc master:Documentation/devicetree
> master:Documentation/devicetree:bindings/arm/coresight.txt:                     "arm,coresight-tmc", "arm,primecell";
> master:Documentation/devicetree:bindings/arm/coresight.txt:             compatible = "arm,coresight-tmc", "arm,primecell";
>                                ^
>                               HERE
> 
> There is no such issue when the branch is not specified:
> 
> $ git grep arm,coresight-tmc Documentation/devicetree
> Documentation/devicetree/bindings/arm/coresight.txt:                    "arm,coresight-tmc", "arm,primecell";
> Documentation/devicetree/bindings/arm/coresight.txt:            compatible = "arm,coresight-tmc", "arm,primecell";
>                         ^
>                     NO ISSUE
> 
> 
> Is this expected behavior?
> The spurious colon prevents one from simply copy/pasting the output.
There's lots of discussion in this thread from last year:
  https://public-inbox.org/git/20170119150347.3484-1-stefanha@redhat.com/
Notably:
  git grep arm,coresight-tmc master -- Documentation/devicetree
will do what you want.
-Peff
Previous: Marc Gonzalez
Message 2 of 2 in “git grep prints colon instead of slash”
  1. Marc GonzalezNov 21, 2018
  2. Jeff KingNov 21, 2018

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.