Subject: Re: [PATCH 21/38] refs: make pack_refs() virtual

From: Michael Haggerty <[email-masked]>
Date: Thu, 9 Jun 2016 16:46:45 +0200

On 06/07/2016 07:35 PM, Junio C Hamano wrote:
> Michael Haggerty <[email-masked]> writes:
> 
>> Signed-off-by: Michael Haggerty <[email-masked]>
>> ---
>>  refs.c               | 7 +++++++
>>  refs/files-backend.c | 6 ++++--
>>  refs/refs-internal.h | 4 ++++
>>  3 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/refs.c b/refs.c
>> index 79ef443..f4f5f32 100644
>> --- a/refs.c
>> +++ b/refs.c
>> @@ -1418,6 +1418,13 @@ void assert_main_repository(struct ref_store *refs, const char *caller)
>>  }
>>  
>>  /* backend functions */
>> +int pack_refs(unsigned int flags)
>> +{
>> +	struct ref_store *refs = get_ref_store(NULL);
>> +
>> +	return refs->be->pack_refs(refs, flags);
>> +}
>> +
> 
> Makes me wonder what it even means to "pack_refs" in the context of
> other possible backends (e.g. lmdb), but higher level API users
> (e.g. "gc") needs something to call to give the backend "here is a
> chance for you to optimize yourself" cue, so perhaps it is OK.

My thinking exactly. This might end up being renamed to optimize_refs()
and be made an optional part of the ref_store interface. But it seemed
premature to worry about that.

Michael