From 62665823d2ddbe69abdac4a9db399769c3e278b4 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 4 Sep 2016 18:08:26 +0200 Subject: refs: make verify_refname_available() virtual Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 14 ++++++++------ refs/refs-internal.h | 7 +++++++ 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'refs') diff --git a/refs/files-backend.c b/refs/files-backend.c index 9cf2f82f74..44eef1cec7 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2549,13 +2549,14 @@ out: return ret; } -int verify_refname_available(const char *newname, - const struct string_list *extras, - const struct string_list *skip, - struct strbuf *err) +static int files_verify_refname_available(struct ref_store *ref_store, + const char *newname, + const struct string_list *extras, + const struct string_list *skip, + struct strbuf *err) { struct files_ref_store *refs = - get_files_ref_store(NULL, "verify_refname_available"); + files_downcast(ref_store, 1, "verify_refname_available"); struct ref_dir *packed_refs = get_packed_refs(refs); struct ref_dir *loose_refs = get_loose_refs(refs); @@ -4021,5 +4022,6 @@ struct ref_storage_be refs_be_files = { files_ref_store_create, files_transaction_commit, - files_read_raw_ref + files_read_raw_ref, + files_verify_refname_available }; diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 19cb6e11ad..6c698f442d 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -542,6 +542,12 @@ typedef int read_raw_ref_fn(struct ref_store *ref_store, const char *refname, unsigned char *sha1, struct strbuf *referent, unsigned int *type); +typedef int verify_refname_available_fn(struct ref_store *ref_store, + const char *newname, + const struct string_list *extras, + const struct string_list *skip, + struct strbuf *err); + struct ref_storage_be { struct ref_storage_be *next; const char *name; @@ -549,6 +555,7 @@ struct ref_storage_be { ref_transaction_commit_fn *transaction_commit; read_raw_ref_fn *read_raw_ref; + verify_refname_available_fn *verify_refname_available; }; extern struct ref_storage_be refs_be_files; -- cgit v1.2.3