summaryrefslogtreecommitdiff
path: root/tests-clar/odb/foreach.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-07-31 10:16:21 -0700
committerVicent Martí <vicent@github.com>2012-07-31 10:16:21 -0700
commitbfb59164687408bcc61b9b75bb391770fae7d9c2 (patch)
treef688fc7c41b7d9c16f7243753db2b5a27f04af90 /tests-clar/odb/foreach.c
parent577cd8aec1b112fc099035817cdb69ec79edc569 (diff)
parent6782245e51af13427cce7eb4dd4d3a4f202c9150 (diff)
downloadlibgit2-bfb59164687408bcc61b9b75bb391770fae7d9c2.tar.gz
Merge pull request #833 from carlosmn/odb-one
odb: allow creating an ODB backend from a packfile index
Diffstat (limited to 'tests-clar/odb/foreach.c')
-rw-r--r--tests-clar/odb/foreach.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests-clar/odb/foreach.c b/tests-clar/odb/foreach.c
index e5d01eafd..be6dbd88a 100644
--- a/tests-clar/odb/foreach.c
+++ b/tests-clar/odb/foreach.c
@@ -7,12 +7,6 @@ static git_odb *_odb;
static git_repository *_repo;
static int nobj;
-void test_odb_foreach__initialize(void)
-{
- cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
- git_repository_odb(&_odb, _repo);
-}
-
void test_odb_foreach__cleanup(void)
{
git_odb_free(_odb);
@@ -41,6 +35,23 @@ static int foreach_cb(git_oid *oid, void *data)
*/
void test_odb_foreach__foreach(void)
{
+ cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
+ git_repository_odb(&_odb, _repo);
+
cl_git_pass(git_odb_foreach(_odb, foreach_cb, NULL));
cl_assert_equal_i(43 + 1640, nobj); /* count + in-pack */
}
+
+void test_odb_foreach__one_pack(void)
+{
+ git_odb_backend *backend = NULL;
+
+ cl_git_pass(git_odb_new(&_odb));
+ cl_git_pass(git_odb_backend_one_pack(&backend, cl_fixture("testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx")));
+ cl_git_pass(git_odb_add_backend(_odb, backend, 1));
+ _repo = NULL;
+
+ nobj = 0;
+ cl_git_pass(git_odb_foreach(_odb, foreach_cb, NULL));
+ cl_assert(nobj == 1628);
+}