Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-04-22 18:41:56 +0400
committerVicent Marti <tanoku@gmail.com>2013-04-22 18:41:56 +0400
commit0edad3cc0451a42b566d70f64611acc214a03022 (patch)
tree9a7c4c7e7ab0be366df168b7f1750f58b8bd86ae /src/odb.c
parent4ef2c79cb6dc81e17b68ccf7c270bcc7e4f85bfb (diff)
parentf063a75882769cb6fc652de425ac16ba4b88b616 (diff)
Merge branch 'development' into vmg/dupe-odb-backendsvmg/dupe-odb-backends
Conflicts: src/odb.c
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/odb.c b/src/odb.c
index 8249c5adc..d6ea8c29a 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -8,6 +8,7 @@
#include "common.h"
#include <zlib.h>
#include "git2/object.h"
+#include "git2/sys/odb_backend.h"
#include "fileops.h"
#include "hash.h"
#include "odb.h"
@@ -407,6 +408,27 @@ int git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority)
return add_backend_internal(odb, backend, priority, true, 0);
}
+size_t git_odb_num_backends(git_odb *odb)
+{
+ assert(odb);
+ return odb->backends.length;
+}
+
+int git_odb_get_backend(git_odb_backend **out, git_odb *odb, size_t pos)
+{
+ backend_internal *internal;
+
+ assert(odb && odb);
+ internal = git_vector_get(&odb->backends, pos);
+
+ if (internal && internal->backend) {
+ *out = internal->backend;
+ return 0;
+ }
+
+ return GIT_ENOTFOUND;
+}
+
static int add_default_backends(
git_odb *db, const char *objects_dir,
bool as_alternates, int alternate_depth)