Michael Haggerty <[email protected]> writes:
> Signed-off-by: Michael Haggerty <[email protected]>
> ---
> 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.
> int ref_transaction_commit(struct ref_transaction *transaction,
> struct strbuf *err)
> {
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index af8de85..e5a8799 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -2358,10 +2358,10 @@ static void prune_refs(struct ref_to_prune *r)
> }
> }
>
> -int pack_refs(unsigned int flags)
> +static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
> {
> struct files_ref_store *refs =
> - get_files_ref_store(NULL, "pack_refs");
> + files_downcast(ref_store, 0, "pack_refs");
> struct pack_refs_cb_data cbdata;
>
> memset(&cbdata, 0, sizeof(cbdata));
> @@ -4026,6 +4026,8 @@ struct ref_storage_be refs_be_files = {
> files_ref_store_create,
> files_transaction_commit,
>
> + files_pack_refs,
> +
> files_read_raw_ref,
> files_verify_refname_available
> };
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index 18e01d0..578c125 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -495,6 +495,8 @@ typedef int ref_transaction_commit_fn(struct ref_store
> *refs,
> struct ref_transaction *transaction,
> struct strbuf *err);
>
> +typedef int pack_refs_fn(struct ref_store *ref_store, unsigned int flags);
> +
> /*
> * Read a reference from the specified reference store, non-recursively.
> * Set type to describe the reference, and:
> @@ -549,6 +551,8 @@ struct ref_storage_be {
> ref_store_init_fn *init;
> ref_transaction_commit_fn *transaction_commit;
>
> + pack_refs_fn *pack_refs;
> +
> read_raw_ref_fn *read_raw_ref;
> verify_refname_available_fn *verify_refname_available;
> };
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html