Re: [RFC 0/2] grep: make output consistent with revision syntax
- From
- Brandon Williams <bmwill@google.com>
- Date
- Jan 19, 2017, 18:26 UTC
- Message-ID
- <20170119182633.GG10641@google.com>
- In-Reply-To
- <20170119165958.xtotlvdta7udqllb@sigill.intra.peff.net>
On 01/19, Jeff King wrote:
Show 9 quoted lines
> On Thu, Jan 19, 2017 at 03:03:45PM +0000, Stefan Hajnoczi wrote: > > > git-grep(1)'s output is not consistent with git-rev-parse(1) revision syntax. > > > > This means you cannot take "rev:path/to/file.c: foo();" output from git-grep(1) > > and expect "git show rev:path/to/file.c" to work. See the individual patches > > for examples of command-lines that produce invalid output. > > I think this is a good goal.
I agree.
> I couldn't immediately think of any cases where your patches would > misbehave, but my initial thought was that the "/" versus ":" > distinction is about whether the initial object is a tree or a commit.
I think this is also the case, I couldn't think of another case where this decision wasn't based on if the object is a tree or a commit. Interestingly enough I don't think we have any tests that exist that test the formatting of grep's output when given a tree object since the test suite still passes with these changes in. Which means this fix should probably include a couple tests to ensure there's no regression in the future.
-- Brandon Williams