public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Bell, Bob (ISG)" <Robert.Bell@dell.com>, Jeff King <peff@peff.net>
Cc: <git@vger.kernel.org>
Subject: Re: Bug Report: git show unnecessarily requires parent tree
Date: Fri, 23 May 2025 10:17:55 -0700	[thread overview]
Message-ID: <xmqqldqnxn3w.fsf@gitster.g> (raw)
In-Reply-To: <IA1PR19MB88859FF5C7E547010E555E7F8198A@IA1PR19MB8885.namprd19.prod.outlook.com> (Bob Bell's message of "Fri, 23 May 2025 06:15:04 +0000")

"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".


  reply	other threads:[~2025-05-23 17:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23  6:15 Bug Report: git show unnecessarily requires parent tree Bell, Bob (ISG)
2025-05-23 17:17 ` Junio C Hamano [this message]
2025-05-23 19:36   ` Bell, Bob (ISG)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqldqnxn3w.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Robert.Bell@dell.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox