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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 23, 2020, 18:06 UTC
Message-ID
<xmqq5zaertrd.fsf@gitster.c.googlers.com>
In-Reply-To
<20200723174747.GA3975154@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> 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.

I actually have to take that "we could even lie to say that content that does not hash to X is object X" back---that was never the intention of this mechanism.

It was to ensure that operations that are supposedly read-only can avoid writing into the repository---"blame" uses it to pretend as if the working tree file already has a corresponding object in the object store, IIRC.

The only reason why hash_object_file() is used here is to allow us discarding the memory held for that working tree copy if it happens to match what is stored in the object database. The saving would be within a few hundred kilobytes to a single digit megabyte range at most, hopefully, so we could drop it (oh, saying "a single digit megabyte" reminds me that my first Linux computer was 486dx with 4MB ram---on that box, it may have mattered).

Previous: Jeff King
Message 5 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.