From: Ronnie Sahlberg <[email protected]>
Signed-off-by: Ronnie Sahlberg <[email protected]>
Signed-off-by: David Turner <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Michael Haggerty <[email protected]>
---
refs.c | 9 +++++++++
refs/files-backend.c | 10 ++++++----
refs/refs-internal.h | 5 +++++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 5e20ae0..904e758 100644
--- a/refs.c
+++ b/refs.c
@@ -1375,3 +1375,12 @@ void assert_main_repository(struct ref_store *refs,
const char *caller)
if (*refs->submodule)
die("BUG: %s called for a submodule", caller);
}
+
+/* backend functions */
+int ref_transaction_commit(struct ref_transaction *transaction,
+ struct strbuf *err)
+{
+ struct ref_store *refs = get_ref_store(NULL);
+
+ return refs->be->transaction_commit(refs, transaction, err);
+}
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 0d64a3d..fea4487 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -3703,11 +3703,12 @@ static int lock_ref_for_update(struct ref_update
*update,
return 0;
}
-int ref_transaction_commit(struct ref_transaction *transaction,
- struct strbuf *err)
+static int files_transaction_commit(struct ref_store *ref_store,
+ struct ref_transaction *transaction,
+ struct strbuf *err)
{
struct files_ref_store *refs =
- get_files_ref_store(NULL, "ref_transaction_commit");
+ files_downcast(ref_store, 0, "ref_transaction_commit");
int ret = 0, i;
struct ref_update **updates = transaction->updates;
struct string_list refs_to_delete = STRING_LIST_INIT_NODUP;
@@ -4097,5 +4098,6 @@ int reflog_expire(const char *refname, const unsigned
char *sha1,
struct ref_storage_be refs_be_files = {
NULL,
"files",
- files_ref_store_create
+ files_ref_store_create,
+ files_transaction_commit
};
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index d6c74cf..e24366b 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -530,10 +530,15 @@ int read_raw_ref(const char *refname, unsigned char *sha1,
*/
typedef struct ref_store *ref_store_init_fn(const char *submodule);
+typedef int ref_transaction_commit_fn(struct ref_store *refs,
+ struct ref_transaction *transaction,
+ struct strbuf *err);
+
struct ref_storage_be {
struct ref_storage_be *next;
const char *name;
ref_store_init_fn *init;
+ ref_transaction_commit_fn *transaction_commit;
};
extern struct ref_storage_be refs_be_files;
--
2.8.1
--
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