8000 Add `git_odb_backend_loose` back by ethomson · Pull Request #6512 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Add git_odb_backend_loose back #6512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
odb: test git_odb_backend_loose
  • Loading branch information
ethomson committed Feb 27, 2023
commit 59bb933c17b74f25f5f0756c15f3afe461d2b73a
43 changes: 43 additions & 0 deletions tests/libgit2/odb/backend/loose.c
Original file line number Diff line number Diff line change
@@ -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);
}
0