From bd427cf27f561174fa8fa14e2c8c321d2df82c47 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 4 Sep 2016 18:08:29 +0200 Subject: refs: make peel_ref() virtual For now it only supports the main reference store. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 6 ++++-- refs/refs-internal.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'refs') diff --git a/refs/files-backend.c b/refs/files-backend.c index fc67cc6ec..af3ad83fe 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1759,9 +1759,10 @@ static enum peel_status peel_entry(struct ref_entry *entry, int repeel) return status; } -int peel_ref(const char *refname, unsigned char *sha1) +static int files_peel_ref(struct ref_store *ref_store, + const char *refname, unsigned char *sha1) { - struct files_ref_store *refs = get_files_ref_store(NULL, "peel_ref"); + struct files_ref_store *refs = files_downcast(ref_store, 0, "peel_ref"); int flag; unsigned char base[20]; @@ -4027,6 +4028,7 @@ struct ref_storage_be refs_be_files = { files_transaction_commit, files_pack_refs, + files_peel_ref, files_create_symref, files_read_raw_ref, diff --git a/refs/refs-internal.h b/refs/refs-internal.h index bf9650385..84c81ad08 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -501,6 +501,8 @@ typedef int ref_transaction_commit_fn(struct ref_store *refs, struct strbuf *err); typedef int pack_refs_fn(struct ref_store *ref_store, unsigned int flags); +typedef int peel_ref_fn(struct ref_store *ref_store, + const char *refname, unsigned char *sha1); typedef int create_symref_fn(struct ref_store *ref_store, const char *ref_target, const char *refs_heads_master, @@ -561,6 +563,7 @@ struct ref_storage_be { ref_transaction_commit_fn *transaction_commit; pack_refs_fn *pack_refs; + peel_ref_fn *peel_ref; create_symref_fn *create_symref; read_raw_ref_fn *read_raw_ref; -- cgit v1.2.1