refs: add method for initial ref transaction commit
authorDavid Turner <dturner@twopensource.com>
Sun, 4 Sep 2016 16:08:39 +0000 (18:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Sep 2016 22:28:14 +0000 (15:28 -0700)
Signed-off-by: Ronnie Sahlberg <rsahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 47dcf494d41f3218f370a6657efc118ab01781c9..693d10fba7d087e129f27e7c1dadae32a445f87f 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1524,3 +1524,11 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
                                       prepare_fn, should_prune_fn,
                                       cleanup_fn, policy_cb_data);
 }
+
+int initial_ref_transaction_commit(struct ref_transaction *transaction,
+                                  struct strbuf *err)
+{
+       struct ref_store *refs = get_ref_store(NULL);
+
+       return refs->be->initial_transaction_commit(refs, transaction, err);
+}
index 336d432572e410a05cd3468ce7912bd4fce764d3..0a511bf5a459c58e029baa443a0a2d8fdfbc5a4d 100644 (file)
@@ -3829,11 +3829,12 @@ static int ref_present(const char *refname,
        return string_list_has_string(affected_refnames, refname);
 }
 
-int initial_ref_transaction_commit(struct ref_transaction *transaction,
-                                  struct strbuf *err)
+static int files_initial_transaction_commit(struct ref_store *ref_store,
+                                           struct ref_transaction *transaction,
+                                           struct strbuf *err)
 {
        struct files_ref_store *refs =
-               get_files_ref_store(NULL, "initial_ref_transaction_commit");
+               files_downcast(ref_store, 0, "initial_ref_transaction_commit");
        int ret = 0, i;
        struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
 
@@ -4061,6 +4062,7 @@ struct ref_storage_be refs_be_files = {
        "files",
        files_ref_store_create,
        files_transaction_commit,
+       files_initial_transaction_commit,
 
        files_pack_refs,
        files_peel_ref,
index a20b62261fca44676b76af0cbb0ce5604af15cb8..08c85861ec6283d8747dcf349dd921397080fc5d 100644 (file)
@@ -582,6 +582,7 @@ struct ref_storage_be {
        const char *name;
        ref_store_init_fn *init;
        ref_transaction_commit_fn *transaction_commit;
+       ref_transaction_commit_fn *initial_transaction_commit;
 
        pack_refs_fn *pack_refs;
        peel_ref_fn *peel_ref;