Re: [PATCH 21/38] refs: make pack_refs() virtual
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Jun 9, 2016, 14:46 UTC
- Message-ID
- <57598155.3040101@alum.mit.edu>
- In-Reply-To
- <xmqqy46grjg5.fsf@gitster.mtv.corp.google.com>
On 06/07/2016 07:35 PM, Junio C Hamano wrote:
Show 29 quoted lines
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>
>> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
>> ---
>> 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