]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: make pack_refs() virtual
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 4 Sep 2016 16:08:27 +0000 (18:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Sep 2016 22:28:13 +0000 (15:28 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs/files-backend.c
refs/refs-internal.h

diff --git a/refs.c b/refs.c
index a5c11088f2e3d3feabafb9c3b27513d391c468a0..cdd78b97ac4bfecab0b6e04767ae1dabd93de2a3 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1421,6 +1421,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);
+}
+
 int ref_transaction_commit(struct ref_transaction *transaction,
                           struct strbuf *err)
 {
index 44eef1cec713a6fe47a6b2d931d16b24ac4ca8e0..5ba2804a86174c8ce5494fe1423b7f459f2287f4 100644 (file)
@@ -2354,10 +2354,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));
@@ -4022,6 +4022,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
 };
index 6c698f442d4029ec799307d87b1ddde3ba5d45e8..256f7f581f97781cb46d3b77864f52153924354c 100644 (file)
@@ -500,6 +500,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:
@@ -554,6 +556,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;
 };