Skip to content

Commit fc68146

Browse files
dturner-twgitster
authored andcommitted
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>
1 parent e3688bd commit fc68146

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

refs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,3 +1524,11 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
15241524
prepare_fn, should_prune_fn,
15251525
cleanup_fn, policy_cb_data);
15261526
}
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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3829,11 +3829,12 @@ static int ref_present(const char *refname,
38293829
return string_list_has_string(affected_refnames, refname);
38303830
}
38313831

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)
38343835
{
38353836
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");
38373838
int ret = 0, i;
38383839
struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
38393840

@@ -4061,6 +4062,7 @@ struct ref_storage_be refs_be_files = {
40614062
"files",
40624063
files_ref_store_create,
40634064
files_transaction_commit,
4065+
files_initial_transaction_commit,
40644066

40654067
files_pack_refs,
40664068
files_peel_ref,

refs/refs-internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ struct ref_storage_be {
582582
const char *name;
583583
ref_store_init_fn *init;
584584
ref_transaction_commit_fn *transaction_commit;
585+
ref_transaction_commit_fn *initial_transaction_commit;
585586

586587
pack_refs_fn *pack_refs;
587588
peel_ref_fn *peel_ref;

0 commit comments

Comments
 (0)