diff options
author | Vicent Martà <vicent@github.com> | 2013-04-22 04:06:11 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-04-22 04:06:11 -0700 |
commit | f063a75882769cb6fc652de425ac16ba4b88b616 (patch) | |
tree | 8c9f02ac9b2e46846367098d3b6328c01cac7781 /src/odb.c | |
parent | bfb4facb3a5e0b650811560fc49d27247fd9d85d (diff) | |
parent | 21ca045100337bcb2905a20a72d42721d18871f9 (diff) | |
download | libgit2-f063a75882769cb6fc652de425ac16ba4b88b616.tar.gz |
Merge pull request #1485 from libgit2/include-git2-sys
Create include/git2/sys and move backend APIs there
Diffstat (limited to 'src/odb.c')
-rw-r--r-- | src/odb.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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" @@ -403,6 +404,27 @@ int git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority) return add_backend_internal(odb, backend, priority, 1); } +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, int as_alternates, int alternate_depth) { git_odb_backend *loose, *packed; |