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
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-19 23:48:33 +0400
committerRussell Belfer <rb@github.com>2013-04-21 22:50:55 +0400
commit83cc70d9fec5f81d07f9fc4133c9515527efb9af (patch)
treea3ddac356c641e6accf8396d08afbebb7bb52336 /tests-clar/odb
parent83041c711cd7d9fccb7a1327e642ce33f0705370 (diff)
Move odb_backend implementors stuff into git2/sys
This moves some of the odb_backend stuff that is related to the internals of an odb_backend implementation into include/git2/sys. Some of the stuff related to streaming I left in include/git2 because it seemed like it would be reasonably needed by a normal user who wanted to stream objects into and out of the ODB. Also, I added APIs for traversing the list of backends so that some of the tests would not need to access ODB internals.
Diffstat (limited to 'tests-clar/odb')
-rw-r--r--tests-clar/odb/packed_one.c3
-rw-r--r--tests-clar/odb/sorting.c18
2 files changed, 10 insertions, 11 deletions
diff --git a/tests-clar/odb/packed_one.c b/tests-clar/odb/packed_one.c
index e9d246c23..4f9bde9ed 100644
--- a/tests-clar/odb/packed_one.c
+++ b/tests-clar/odb/packed_one.c
@@ -1,5 +1,6 @@
#include "clar_libgit2.h"
-#include "odb.h"
+#include "git2/odb_backend.h"
+
#include "pack_data_one.h"
#include "pack.h"
diff --git a/tests-clar/odb/sorting.c b/tests-clar/odb/sorting.c
index b4f9e44bc..147a160c8 100644
--- a/tests-clar/odb/sorting.c
+++ b/tests-clar/odb/sorting.c
@@ -1,13 +1,12 @@
#include "clar_libgit2.h"
-#include "git2/odb_backend.h"
-#include "odb.h"
+#include "git2/sys/odb_backend.h"
typedef struct {
git_odb_backend base;
- int position;
+ size_t position;
} fake_backend;
-static git_odb_backend *new_backend(int position)
+static git_odb_backend *new_backend(size_t position)
{
fake_backend *b;
@@ -22,14 +21,13 @@ static git_odb_backend *new_backend(int position)
static void check_backend_sorting(git_odb *odb)
{
- unsigned int i;
-
- for (i = 0; i < odb->backends.length; ++i) {
- fake_backend *internal =
- *((fake_backend **)git_vector_get(&odb->backends, i));
+ size_t i, max_i = git_odb_num_backends(odb);
+ fake_backend *internal;
+ for (i = 0; i < max_i; ++i) {
+ cl_git_pass(git_odb_get_backend((git_odb_backend **)&internal, odb, i));
cl_assert(internal != NULL);
- cl_assert(internal->position == (int)i);
+ cl_assert_equal_sz(i, internal->position);
}
}