Re: [PATCH 3/4] object-file: refactor replace object lookup
- From
Jeff King <peff@peff.net>
- Date
- Nov 30, 2022, 20:54 UTC
- Message-ID
- <Y4fC6HSkpYXKPVCr@coredump.intra.peff.net>
- In-Reply-To
- <940396307fea59b434d33edbf2c7f98adc62c053.1669839849.git.jonathantanmy@google.com>
On Wed, Nov 30, 2022 at 12:30:48PM -0800, Jonathan Tan wrote:
Show 9 quoted lines
> diff --git a/object-store.h b/object-store.h
> index 88c879c61e..9684562eb2 100644
> --- a/object-store.h
> +++ b/object-store.h
> @@ -406,6 +406,7 @@ struct object_info {
> struct object_id *delta_base_oid;
> struct strbuf *type_name;
> void **contentp;
> + const struct object_id **real_oidp;OK. The double-pointer here is a bit funky as an interface. It may point back to the "oid" we fed the function, or it may point to long-term storage owned by the replace mechanism. A more straightforward one would be to store a single-pointer to caller-owned storage, and copy to that (like we do for delta_base_oid, for example).
But doing it this way avoids extra oid copies in the normal, non-replaced case, and matches how the current callers view things. So while it's a little convoluted, I think it makes sense to do it as you did.
-Peff