Re: [PATCH v2 3/3] commit: don't lazy-fetch commits
- From
Jeff King <peff@peff.net>
- Date
- Dec 7, 2022, 06:47 UTC
- Message-ID
- <Y5A3EkxY8p6XptWt@coredump.intra.peff.net>
- In-Reply-To
- <c5fe42deb04285b85d5354a57e90bf9410cc2420.1670373420.git.jonathantanmy@google.com>
On Tue, Dec 06, 2022 at 04:40:53PM -0800, Jonathan Tan wrote:
Show 8 quoted lines
> @@ -516,8 +527,8 @@ int repo_parse_commit_internal(struct repository *r, > return 0; > if (use_commit_graph && parse_commit_in_graph(r, item)) > return 0; > - buffer = repo_read_object_file(r, &item->object.oid, &type, &size); > - if (!buffer) > + > + if (oid_object_info_extended(r, &item->object.oid, &oi, flags) < 0)
Nice. And this swap-out is much more obviously correct in this version of the series because read_object_file_extended() is now clearly a thin wrapper around oid_object_info_extended(), after your patch 2.
I actually think it would be beneficial to do a bit more refactoring there to eliminate read_object() entirely (in favor of just having the two callers use oid_object_info_extended() directly), and having repo_read_object_extended() pass OBJECT_INFO_LOOKUP_REPLACE instead of doing its own lookup.
But as that's all orthogonal to your goal, I don't mind if we punt on it for now. We can do it later on top.
-Peff