diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2023-02-27 14:23:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-27 14:23:35 -0800 |
commit | a7561e0eda0b204a364e347a38a856eb0fbbbb30 (patch) | |
tree | 006f21b09284236e0fb11041e4e934287f1832ca /tests/libgit2 | |
parent | c0dc97be957d5625af6d6fe900f0201dba484097 (diff) | |
parent | 59bb933c17b74f25f5f0756c15f3afe461d2b73a (diff) | |
download | libgit2-a7561e0eda0b204a364e347a38a856eb0fbbbb30.tar.gz |
Merge pull request #6512 from libgit2/ethomson/odb_loose
Diffstat (limited to 'tests/libgit2')
-rw-r--r-- | tests/libgit2/odb/backend/loose.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/libgit2/odb/backend/loose.c b/tests/libgit2/odb/backend/loose.c new file mode 100644 index 000000000..781b61d9f --- /dev/null +++ b/tests/libgit2/odb/backend/loose.c @@ -0,0 +1,43 @@ +#include "clar_libgit2.h" +#include "repository.h" +#include "odb.h" +#include "backend_helpers.h" +#include "git2/sys/mempack.h" + +static git_repository *_repo; +static git_odb *_odb; + +void test_odb_backend_loose__initialize(void) +{ + git_odb_backend *backend; + + cl_fixture_sandbox("testrepo.git"); + +#ifdef GIT_EXPERIMENTAL_SHA256 + cl_git_pass(git_odb_backend_loose(&backend, "testrepo.git/objects", NULL)); +#else + cl_git_pass(git_odb_backend_loose(&backend, "testrepo.git/objects", 0, 0, 0, 0)); +#endif + + cl_git_pass(git_odb__new(&_odb, NULL)); + cl_git_pass(git_odb_add_backend(_odb, backend, 10)); + cl_git_pass(git_repository_wrap_odb(&_repo, _odb)); +} + +void test_odb_backend_loose__cleanup(void) +{ + git_odb_free(_odb); + git_repository_free(_repo); + + cl_fixture_cleanup("testrepo.git"); +} + +void test_odb_backend_loose__read(void) +{ + git_oid oid; + git_odb_object *obj; + + cl_git_pass(git_oid__fromstr(&oid, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1)); + cl_git_pass(git_odb_read(&obj, _odb, &oid)); + git_odb_object_free(obj); +} |