summaryrefslogtreecommitdiff
path: root/refs/refs-internal.h
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-09-04 18:08:25 +0200
committerJunio C Hamano <gitster@pobox.com>2016-09-09 15:28:13 -0700
commite1e33b722c50c26546335fd5a709f89726c2ea2a (patch)
tree67a5ddc35e29923e849e841567e7746dd5a3e6b1 /refs/refs-internal.h
parenta8355bb717aaf2d5d9b3781aa78402d0053fa87a (diff)
downloadgit-e1e33b722c50c26546335fd5a709f89726c2ea2a.tar.gz
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>
Diffstat (limited to 'refs/refs-internal.h')
-rw-r--r--refs/refs-internal.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index fa41d510c2..19cb6e11ad 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -486,6 +486,20 @@ int do_for_each_ref_iterator(struct ref_iterator *iter,
struct ref_store;
+/* refs backends */
+
+/*
+ * Initialize the ref_store for the specified submodule, or for the
+ * main repository if submodule == NULL. These functions should call
+ * base_ref_store_init() to initialize the shared part of the
+ * ref_store and to record the ref_store for later lookup.
+ */
+typedef struct ref_store *ref_store_init_fn(const char *submodule);
+
+typedef int ref_transaction_commit_fn(struct ref_store *refs,
+ struct ref_transaction *transaction,
+ struct strbuf *err);
+
/*
* Read a reference from the specified reference store, non-recursively.
* Set type to describe the reference, and:
@@ -524,29 +538,17 @@ struct ref_store;
* - in all other cases, referent will be untouched, and therefore
* refname will still be valid and unchanged.
*/
-int read_raw_ref(struct ref_store *ref_store,
- const char *refname, unsigned char *sha1,
- struct strbuf *referent, unsigned int *type);
-
-/* refs backends */
-
-/*
- * Initialize the ref_store for the specified submodule, or for the
- * main repository if submodule == NULL. These functions should call
- * base_ref_store_init() to initialize the shared part of the
- * ref_store and to record the ref_store for later lookup.
- */
-typedef struct ref_store *ref_store_init_fn(const char *submodule);
-
-typedef int ref_transaction_commit_fn(struct ref_store *refs,
- struct ref_transaction *transaction,
- struct strbuf *err);
+typedef int read_raw_ref_fn(struct ref_store *ref_store,
+ const char *refname, unsigned char *sha1,
+ struct strbuf *referent, unsigned int *type);
struct ref_storage_be {
struct ref_storage_be *next;
const char *name;
ref_store_init_fn *init;
ref_transaction_commit_fn *transaction_commit;
+
+ read_raw_ref_fn *read_raw_ref;
};
extern struct ref_storage_be refs_be_files;