pack-refs: teach --exclude option to exclude refs from being packed

At GitLab, we have a system that creates ephemeral internal refs that
don't live long before getting deleted. Having an option to exclude
certain refs from a packed-refs file allows these internal references to
be deleted much more efficiently.

Add an --exclude option to the pack-refs builtin, and use the ref
exclusions API to exclude certain refs from being packed into the final
packed-refs file

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
John Cai
2023-05-12 21:34:41 +00:00
committed by Junio C Hamano
parent 283174b214
commit 826ae79fca
11 changed files with 69 additions and 20 deletions

View File

@@ -122,10 +122,10 @@ static int debug_initial_transaction_commit(struct ref_store *refs,
return res;
}
static int debug_pack_refs(struct ref_store *ref_store, unsigned int flags)
static int debug_pack_refs(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, flags);
int res = drefs->refs->be->pack_refs(drefs->refs, opts);
trace_printf_key(&trace_refs, "pack_refs: %d\n", res);
return res;
}