refs: make read_raw_ref() virtual
Reference backends will be able to customize this function to implement
reference reading.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 979cee8..9cf2f82 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1349,9 +1349,9 @@
return -1;
}
-int read_raw_ref(struct ref_store *ref_store,
- const char *refname, unsigned char *sha1,
- struct strbuf *referent, unsigned int *type)
+static int files_read_raw_ref(struct ref_store *ref_store,
+ const char *refname, unsigned char *sha1,
+ struct strbuf *referent, unsigned int *type)
{
struct files_ref_store *refs =
files_downcast(ref_store, 1, "read_raw_ref");
@@ -1623,8 +1623,8 @@
* fear that its value will change.
*/
- if (read_raw_ref(ref_store, refname,
- lock->old_oid.hash, referent, type)) {
+ if (files_read_raw_ref(ref_store, refname,
+ lock->old_oid.hash, referent, type)) {
if (errno == ENOENT) {
if (mustexist) {
/* Garden variety missing reference. */
@@ -4019,5 +4019,7 @@
NULL,
"files",
files_ref_store_create,
- files_transaction_commit
+ files_transaction_commit,
+
+ files_read_raw_ref
};