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 | 1 + refs.c | 4 +++- refs.h | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/refs-be-files.c b/refs-be-files.c index 37e244a..eaa74b6 100644 --- a/refs-be-files.c +++ b/refs-be-files.c @@ -3737,6 +3737,7 @@ int reflog_expire(const char *refname, const unsigned char *sha1, struct ref_be refs_be_files = { NULL, "files", + NULL, files_transaction_begin, files_transaction_update, files_transaction_create, diff --git a/refs.c b/refs.c index 769574d..9ce10b7 100644 --- a/refs.c +++ b/refs.c @@ -19,13 +19,15 @@ 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; + if (be->init_backend) + be->init_backend(init_data); return 0; } return 1; diff --git a/refs.h b/refs.h index 0b407b2..0dc626e 100644 --- a/refs.h +++ b/refs.h @@ -586,6 +586,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 struct ref_transaction *(*ref_transaction_begin_fn)(struct strbuf *err); typedef int (*ref_transaction_update_fn)(struct ref_transaction *transaction, const char *refname, const unsigned char *new_sha1, @@ -641,6 +642,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_begin_fn transaction_begin; ref_transaction_update_fn transaction_update; ref_transaction_create_fn transaction_create; @@ -669,6 +671,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