Subject: Re: [PATCH 1/4] refs: move to using the '.optimize' functions

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 16 Oct 2025 12:37:02 +0200

On Wed, Oct 15, 2025 at 05:05:46PM -0500, Justin Tobler wrote:
> On 25/10/15 11:25PM, Karthik Nayak wrote:
> > diff --git a/refs/debug.c b/refs/debug.c
> > index 01499b9033..40cd1d9c15 100644
> > --- a/refs/debug.c
> > +++ b/refs/debug.c
> > @@ -116,11 +116,11 @@ static int debug_transaction_abort(struct ref_store *refs,
> >  	return res;
> >  }
> >  
> > -static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *opts)
> > +static int debug_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)
> >  {
> >  	struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
> > -	int res = drefs->refs->be->pack_refs(drefs->refs, opts);
> > -	trace_printf_key(&trace_refs, "pack_refs: %d\n", res);
> > +	int res = drefs->refs->be->optimize(drefs->refs, opts);
> > +	trace_printf_key(&trace_refs, "optimize: %d\n", res);
> >  	return res;
> >  }
> >  
> > @@ -430,7 +430,7 @@ struct ref_storage_be refs_be_debug = {
> >  	.transaction_finish = debug_transaction_finish,
> >  	.transaction_abort = debug_transaction_abort,
> >  
> > -	.pack_refs = debug_pack_refs,
> > +	.optimize = debug_optimize,
> 
> question: Was the debug backend not using either of these callbacks?
> From the commit message, it sounds like all the backends were using the
> optimize callback.

Doesn't look like it. Overall I kind of doubt the value that this
backend has. I have never had even a single use case for it, and I have
been working with references extensively over the last two or three
years by now.

Maybe we should just drop it eventually?

Patrick