Re: [GSoC][PATCH v3 1/9] refs: add a generic 'optimize' API
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 18, 2025, 15:39 UTC
- Message-ID
- <xmqqjz1v93cm.fsf@gitster.g>
- In-Reply-To
- <aMvigMLPeQE-n-o_@ArchLinux>
shejialuo <shejialuo@gmail.com> writes:
Show 16 quoted lines
>> diff --git a/refs.c b/refs.c
>> index 4ff55cf24f..2ea6fd2218 100644
>> --- a/refs.c
>> +++ b/refs.c
>> @@ -2282,6 +2282,13 @@ int refs_pack_refs(struct ref_store *refs, struct pack_refs_opts *opts)
>> return refs->be->pack_refs(refs, opts);
>> }
>>
>> +int refs_optimize(struct ref_store *refs, struct pack_refs_opts *opts)
>> +{
>> + if (!refs->be->optimize)
>> + return 0;
>
> I don't think we need to check `refs->be->optimize`. Even though for
> some backends, we won't do any optimization, we should register this
> callback instead of assigning `NULL`.Yeah, all the existing functions at the refs.c level simply assumes that refs->be->method always exists, and it would be sensible to be coherent with them.
Thanks.