summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2016-09-04 16:08:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-09 22:28:12 (GMT)
commit3dce444f178503bf3da13ade6f79c80d6964d175 (patch)
tree85c8e334ab027c9abcfb249c4337c711f2bf43c1 /refs.c
parent65a0a8e5facb42f41561a96af209016954878b63 (diff)
downloadgit-3dce444f178503bf3da13ade6f79c80d6964d175.zip
git-3dce444f178503bf3da13ade6f79c80d6964d175.tar.gz
git-3dce444f178503bf3da13ade6f79c80d6964d175.tar.bz2
refs: add a backend method structure
Add a `struct ref_storage_be` to represent types of reference stores. In OO notation, this is the class, and will soon hold some class methods (e.g., a factory to create new ref_store instances) and will also serve as the vtable for ref_store instances of that type. As yet, the backends cannot do anything. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 256fef5..bee9a45 100644
--- a/refs.c
+++ b/refs.c
@@ -10,6 +10,25 @@
#include "tag.h"
/*
+ * List of all available backends
+ */
+static struct ref_storage_be *refs_backends = &refs_be_files;
+
+static struct ref_storage_be *find_ref_storage_backend(const char *name)
+{
+ struct ref_storage_be *be;
+ for (be = refs_backends; be; be = be->next)
+ if (!strcmp(be->name, name))
+ return be;
+ return NULL;
+}
+
+int ref_storage_backend_exists(const char *name)
+{
+ return find_ref_storage_backend(name) != NULL;
+}
+
+/*
* How to handle various characters in refnames:
* 0: An acceptable character for refs
* 1: End-of-component