diff options
| author | Carlos Martín Nieto <cmn@elego.de> | 2012-07-21 16:23:49 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@elego.de> | 2012-07-21 16:23:49 +0200 |
| commit | 507523c32f71056a106f85712fe2086fdb94fbd0 (patch) | |
| tree | d369f3f39a14fa48a06a24a632b1f1916b93670d /tests-clar/odb/foreach.c | |
| parent | 71d273583755c0a2b7f5d608f017f4586add51e4 (diff) | |
| download | libgit2-507523c32f71056a106f85712fe2086fdb94fbd0.tar.gz | |
odb: allow creating an ODB backend from a packfile index
git_odb_backend_one_packfile() allows us to create an ODB backend out
of an .idx file.
Diffstat (limited to 'tests-clar/odb/foreach.c')
| -rw-r--r-- | tests-clar/odb/foreach.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tests-clar/odb/foreach.c b/tests-clar/odb/foreach.c index 525c70c09..9b90aff7b 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); @@ -31,6 +25,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(nobj == 1683); } + +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); +} |
