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 20, 2017, 22:56 UTC
Message-ID
<xmqq60l9wdb9.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170120141954.xyocl6oqoykqmpl5@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 16 quoted lines
> It's not ignored; just as with git-log, it's a pathspec to limit the
> diff. E.g.:
>
>   $ git show --name-status v2.9.3
>   ...
>   M       Documentation/RelNotes/2.9.3.txt
>   M       Documentation/git.txt
>   M       GIT-VERSION-GEN
>
>   $ git show --name-status v2.9.3 -- Documentation
>   M       Documentation/RelNotes/2.9.3.txt
>   M       Documentation/git.txt
>
> That's typically less useful than it is with log (where limiting the
> diff also kicks in history simplification and omits some commits
> entirely). But it does do something.

I think Stefan is missing the fact that the argument to "git show <tree-ish>:<path>" actually is naming a blob that sits at the <path> in the <tree-ish>. In other words, "show" is acting as a glorified "git -p cat-file blob", in that use.

The use of "git show" you are demonstrating is still about showing the commit object, whose behaviour is defined to show the log message and the diff relative to its sole parent, limited to the paths that match the pathspec.

It is perfectly fine and desirable that "git show <commit>:<path>" and "git show <commit> -- <path>" behaves differently. These are two completely different features.

Previous: Jeff KingNext: Stefan Hajnoczi
Message 6 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.