The file backend doesn't need this function, but other backends might. Signed-off-by: David Turner <dturner@xxxxxxxxxxxxxxxx> Signed-off-by: Ronnie Sahlberg <rsahlberg@xxxxxxxxxx> --- refs-be-files.c | 6 ++++++ refs.c | 3 ++- refs.h | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/refs-be-files.c b/refs-be-files.c index 73111e7..f123459 100644 --- a/refs-be-files.c +++ b/refs-be-files.c @@ -3307,6 +3307,11 @@ static int ref_present(const char *refname, return string_list_has_string(affected_refnames, refname); } + +void files_init_backend(void *data) +{ + /* do nothing */ +} int initial_ref_transaction_commit(struct ref_transaction *transaction, struct strbuf *err) @@ -3532,6 +3537,7 @@ int reflog_expire(const char *refname, const unsigned char *sha1, struct ref_be refs_be_files = { NULL, "files", + files_init_backend, files_transaction_commit, files_resolve_ref_unsafe, files_verify_refname_available, diff --git a/refs.c b/refs.c index 1de8529..6370ace 100644 --- a/refs.c +++ b/refs.c @@ -19,13 +19,14 @@ struct ref_be *refs_backends = &refs_be_files; /* * This function is used to switch to an alternate backend. */ -int set_refs_backend(const char *name) +int set_refs_backend(const char *name, void *init_data) { struct ref_be *be; for (be = refs_backends; be; be = be->next) if (!strcmp(be->name, name)) { the_refs_backend = be; + be->init_backend(init_data); return 0; } return 1; diff --git a/refs.h b/refs.h index 6d284f5..e76553a 100644 --- a/refs.h +++ b/refs.h @@ -675,6 +675,7 @@ extern int reflog_expire(const char *refname, const unsigned char *sha1, void *policy_cb_data); /* refs backends */ +typedef void ref_backend_init_fn(void *data); typedef int ref_transaction_commit_fn(struct ref_transaction *transaction, struct strbuf *err); typedef void ref_transaction_free_fn(struct ref_transaction *transaction); @@ -714,6 +715,7 @@ typedef int for_each_reftype_fullpath_fn(each_ref_fn fn, char *type, struct ref_be { struct ref_be *next; const char *name; + ref_backend_init_fn *init_backend; ref_transaction_commit_fn *transaction_commit; resolve_ref_unsafe_fn *resolve_ref_unsafe; verify_refname_available_fn *verify_refname_available; @@ -736,6 +738,6 @@ struct ref_be { extern struct ref_be refs_be_files; -int set_refs_backend(const char *name); +int set_refs_backend(const char *name, void *init_data); #endif /* REFS_H */ -- 2.4.2.644.g97b850b-twtrsrc -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html