[GSoC][PATCH v3 4/9] builtin/pack-refs: convert to use the generic refs_optimize() API
- From
Meet Soni <meetsoni3017@gmail.com>
- Date
- Sep 18, 2025, 05:46 UTC
- Message-ID
- <20250918054704.544254-5-meetsoni3017@gmail.com>
- In-Reply-To
- <20250918054704.544254-1-meetsoni3017@gmail.com>
The `git pack-refs` command is tied to the 'files' reference backend. In a repository that uses a different backend (like 'reftable'), the command is a no-op.
To make `git pack-refs` a truly generic frontend for reference optimization, refactor it to use the new generic `refs_optimize()` API. This will allow the command to automatically work with any backend that implements the `optimize` action in the future.
The command continues to handle parsing its own command-line options, but now calls the generic API to perform the action instead of a backend-specific function.
Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Meet Soni <meetsoni3017@gmail.com> --- builtin/pack-refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index 5e28d0f9e8..dfcf664524 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -51,7 +51,7 @@ int cmd_pack_refs(int argc, if (!pack_refs_opts.includes->nr) string_list_append(pack_refs_opts.includes, "refs/tags/*"); - ret = refs_pack_refs(get_main_ref_store(repo), &pack_refs_opts); + ret = refs_optimize(get_main_ref_store(repo), &pack_refs_opts); clear_ref_exclusions(&excludes); string_list_clear(&included_refs, 0);
-- 2.34.1