reftable-backend: implement 'optimize' action

To make the new generic `optimize` API fully functional, provide an implementation for the 'reftable' reference backend. For the reftable backend, the 'optimize' action is to compact its tables. The existing `reftable_be_pack_refs()` function already provides this logic, so the new `reftable_be_optimize()` function simply calls it. Wire up the new function to the `optimize` slot in the reftable backend's virtual table. Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Meet Soni <meetsoni3017@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Meet Soni committed Sep 19, 2025 at 13:56 UTC da0849a71e08ad072700b7cd1a0cb8b6fb89c50a
1 file changed +7
refs/reftable-backend.c
+7
@@ -1721,6 +1721,12 @@ out:
1721 return ret;
1722 }
1723
1724 +static int reftable_be_optimize(struct ref_store *ref_store,
1725 + struct pack_refs_opts *opts)
1726 +{
1727 + return reftable_be_pack_refs(ref_store, opts);
1728 +}
1729 +
1730 struct write_create_symref_arg {
1731 struct reftable_ref_store *refs;
1732 struct reftable_stack *stack;
@@ -2702,6 +2708,7 @@ struct ref_storage_be refs_be_reftable = {
2708 .transaction_abort = reftable_be_transaction_abort,
2709
2710 .pack_refs = reftable_be_pack_refs,
2711 + .optimize = reftable_be_optimize,
2712 .rename_ref = reftable_be_rename_ref,
2713 .copy_ref = reftable_be_copy_ref,
2714