# git grep prints colon instead of slash

2 messages from 2018-11-21 to 2018-11-21. Participants: Marc Gonzalez, Jeff King.
Thread: https://gitlist.dev/t/49873

## Marc Gonzalez, 2018-11-21 13:54

Subject: git grep prints colon instead of slash
Message-ID: <5d3618d4-8a5a-b4dc-3cc9-4134cd73675a@free.fr>
URL: https://gitlist.dev/e/5d3618d4-8a5a-b4dc-3cc9-4134cd73675a%40free.fr

```
Hello,

I'm using an older version of git, so this particular issue might have
already been fixed.

$ git --version
git version 2.17.1


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.

Regards.

```

## Jeff King, 2018-11-21 13:59

Subject: Re: git grep prints colon instead of slash
Message-ID: <20181121135921.GA9586@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20181121135921.GA9586%40sigill.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:

> 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

```
