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

Re: [PATCH] sha1-file: make pretend_object_file() not prefetch

From
Jeff King <peff@peff.net>
Date
Jul 23, 2020, 17:47 UTC
Message-ID
<20200723174747.GA3975154@coredump.intra.peff.net>
In-Reply-To
<xmqq4kq078ks.fsf@gitster.c.googlers.com>
On Tue, Jul 21, 2020 at 04:27:15PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> > When pretend_object_file() is invoked with an object that does not exist
> > (as is the typical case), there is no need to fetch anything from the
> > promisor remote, because the caller already knows what the object is
> > supposed to contain. Therefore, suppress the fetch. (The
> > OBJECT_INFO_QUICK flag is added for the same reason.)
> 
> Yes, "pretend" is also a way to lie about the contents IIRC, so even
> if the object is available elsewhere, we should *not* fetch from the
> promisor.  Makes sense to me.

I agree this patch is fine, but I wonder if it could go even further. If we are pretending some particular contents, shouldn't we override anything that might be in the object database? I.e., could we eliminate this has_object_file() entirely?

That should be OK for the same reason that it's OK to use QUICK.

There's only one caller of this function (git-blame), which I think would be happy with such a change.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 5 in “sha1-file: make pretend_object_file() not prefetch”
  1. sha1-file: make pretend_object_file() not prefetchJonathan Tan, Jul 21, 2020
  2. Junio C HamanoJul 21, 2020
  3. Junio C HamanoJul 21, 2020
  4. Jeff KingJul 23, 2020
  5. Junio C HamanoJul 23, 2020

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.