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

Re: [RFC 2/2] grep: use '/' delimiter for paths

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 19, 2017, 18:54 UTC
Message-ID
<xmqqpoji2851.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170119150347.3484-3-stefanha@redhat.com>
Stefan Hajnoczi <stefanha@redhat.com> writes:
Show 7 quoted lines
> If the tree contains a sub-directory then git-grep(1) output contains a
> colon character instead of a path separator:
>
>   $ git grep malloc v2.9.3:t
>   v2.9.3:t:test-lib.sh:	setup_malloc_check () {
>   $ git show v2.9.3:t:test-lib.sh
>   fatal: Path 't:test-lib.sh' does not exist in 'v2.9.3'

I am slightly less negative on this compared to 1/2, but not by a big margin. The user wanted to feed a subtree to the command, instead of doing the more natural

    $ git grep -e malloc v2.9.3 -- t

So again, "contains a colon character" is not coming from what Git does, but the user gave Git "a colon character" when she didn't have to.

Having said that, if we wanted to start ignoring what the end-user said in the initial input like 1/2 and 2/2 does (i.e. "this specific tree object" as an input), I think the approach to solve for 1/2 and 2/2 should be the same. I think we should decide to do a slash instead of a colon, not because v2.9.3: has colon at the end and v2.9.3:t has colon in it, but because both of these are both bare tree objects. The patches presented does not seem to base their decision on the actual object type but on the textual input, which seems wrong.

Previous: Stefan HajnocziNext: Stefan Hajnoczi
Message 3 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.