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

Re: [RFC 0/2] grep: make output consistent with revision syntax

From
Jeff King <peff@peff.net>
Date
Jan 19, 2017, 16:59 UTC
Message-ID
<20170119165958.xtotlvdta7udqllb@sigill.intra.peff.net>
In-Reply-To
<20170119150347.3484-1-stefanha@redhat.com>
On Thu, Jan 19, 2017 at 03:03:45PM +0000, Stefan Hajnoczi wrote:
Show 5 quoted lines
> 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 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.

You do still have to special case the root tree (so "v2.9.3:" does not get any delimiter). I think "ends in a colon" is actually a reasonable way of determining that.

> This series is an incomplete attempt at solving the issue.  I'm not familiar
> enough with the git codebase to propose a better solution.  Perhaps someone is
> interested in a proper fix?
Are there cases you know that aren't covered by your patches?
-Peff
Previous: Philip OakleyNext: Brandon Williams
Message 18 of 21 in “[RFC 0/2] grep: make output consistent with revision syntax”
  1. Stefan HajnocziJan 19, 2017
  2. 2/2 grep: use '/' delimiter for pathsStefan Hajnoczi, Jan 19, 2017
  3. Junio C HamanoJan 19, 2017
  4. Stefan HajnocziJan 20, 2017
  5. Jeff KingJan 20, 2017
  6. Junio C HamanoJan 20, 2017
  7. Stefan HajnocziJan 23, 2017
  8. Phil HordJan 24, 2017
  9. Brandon WilliamsJan 19, 2017
  10. Stefan HajnocziJan 20, 2017
  11. 1/2 grep: only add delimiter if there isn't one alreadyStefan Hajnoczi, Jan 19, 2017
  12. Junio C HamanoJan 19, 2017
  13. Stefan HajnocziJan 20, 2017
  14. Junio C HamanoJan 20, 2017
  15. Stefan HajnocziJan 23, 2017
  16. Jakub NarębskiJan 24, 2017
  17. Philip OakleyJan 24, 2017
  18. Jeff KingJan 19, 2017
  19. Brandon WilliamsJan 19, 2017
  20. Stefan HajnocziJan 20, 2017
  21. Jeff KingJan 20, 2017

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.