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

Re: Bug Report: git show unnecessarily requires parent tree

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2025, 17:17 UTC
Message-ID
<xmqqldqnxn3w.fsf@gitster.g>
In-Reply-To
<IA1PR19MB88859FF5C7E547010E555E7F8198A@IA1PR19MB8885.namprd19.prod.outlook.com>
"Bell, Bob (ISG)" <Robert.Bell@dell.com> writes:
> What did you do before the bug happened? (Steps to reproduce your issue)
> Tree-less git partial clone: git clone --filter=tree:0 https://...
> Remove the promisor to prevent retrieving more objects: git config --local --unset remote.origin.promisor

At this point, your repository is officially corrupt, but it is a very effective way to demonstrate the underlying issue that exists even if your repository weren't corrupt.

I do agree with you that "git show -s", without any other options like --diff-filter that affects the commit selection [*], should not have to look into its tree. Unlike "git log -p", it should not have to see the tree of the commit is the same or different from the tree of the parent commit in order to decide if the commit should be shown.

The fact that it gave an error "attempting to read the tree" is your own making by corrupting your repository ;-), but it is done as an easy way to demonstrate the underlying issue, which is that it is suboptimal for it to try to access the tree of the commit in a case where it should not have to.

Is this essentially the same issue as these?

https://lore.kernel.org/git/YqEyh5opAaJxph2+@coredump.intra.peff.net/ https://lore.kernel.org/git/20250504082715.GA6257@coredump.intra.peff.net/

[Footnote]
 * "git show -s --diff-filter=D" on a commit that does not delete
   any paths is silent.  "-s" merely says "do not show the output
   from the diff machinery".  The same for pathspec, to wit:
   $ git commit --allow-empty -m empty
   $ git show -s .
   It asks "if there are any changes to paths that match the
   pathspec, show the commit but do not show the diff output".
Previous: Bell, Bob (ISG)Next: Bell, Bob (ISG)
Message 2 of 3 in “Bug Report: git show unnecessarily requires parent tree”
  1. Bell, Bob (ISG)May 23, 2025
  2. Junio C HamanoMay 23, 2025
  3. Bell, Bob (ISG)May 23, 2025

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.