refs: add method for initial ref transaction commit
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>
David Turner committed
Sep 4, 2016 at 18:08 UTC
fc6814637d2e756029b45cb5fd952359bfec6f88
3 files changed
+14
-3
refs.c
+8
@@ -1524,3 +1524,11 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
1524
prepare_fn, should_prune_fn,
1525
cleanup_fn, policy_cb_data);
1526
}
1527
+
1528
+int initial_ref_transaction_commit(struct ref_transaction *transaction,
1529
+ struct strbuf *err)
1530
+{
1531
+ struct ref_store *refs = get_ref_store(NULL);
1532
+
1533
+ return refs->be->initial_transaction_commit(refs, transaction, err);
1534
+}
refs/files-backend.c
+5
-3
@@ -3829,11 +3829,12 @@ static int ref_present(const char *refname,
3829
return string_list_has_string(affected_refnames, refname);
3830
}
3831
3832
-int initial_ref_transaction_commit(struct ref_transaction *transaction,
3833
- struct strbuf *err)
3832
+static int files_initial_transaction_commit(struct ref_store *ref_store,
3833
+ struct ref_transaction *transaction,
3834
+ struct strbuf *err)
3835
{
3836
struct files_ref_store *refs =
3836
- get_files_ref_store(NULL, "initial_ref_transaction_commit");
3837
+ files_downcast(ref_store, 0, "initial_ref_transaction_commit");
3838
int ret = 0, i;
3839
struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
3840
@@ -4061,6 +4062,7 @@ struct ref_storage_be refs_be_files = {
4062
"files",
4063
files_ref_store_create,
4064
files_transaction_commit,
4065
+ files_initial_transaction_commit,
4066
4067
files_pack_refs,
4068
files_peel_ref,
refs/refs-internal.h
+1
@@ -582,6 +582,7 @@ struct ref_storage_be {
582
const char *name;
583
ref_store_init_fn *init;
584
ref_transaction_commit_fn *transaction_commit;
585
+ ref_transaction_commit_fn *initial_transaction_commit;
586
587
pack_refs_fn *pack_refs;
588
peel_ref_fn *peel_ref;