summaryrefslogtreecommitdiff
path: root/tests/libgit2/odb/open.c
blob: 395406d0f3ceaddbca9d5e88ac25c43eb78e59c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "clar_libgit2.h"

void test_odb_open__initialize(void)
{
	cl_fixture_sandbox("testrepo.git");
}

void test_odb_open__cleanup(void)
{
	cl_fixture_cleanup("testrepo.git");
}

void test_odb_open__exists(void)
{
	git_odb *odb;
	git_oid one, two;

#ifdef GIT_EXPERIMENTAL_SHA256
	git_odb_options opts = GIT_ODB_OPTIONS_INIT;

	cl_git_pass(git_odb_open(&odb, "testrepo.git/objects", &opts));
	cl_git_pass(git_oid_fromstr(&one, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1));
	cl_git_pass(git_oid_fromstr(&two, "00112233445566778899aabbccddeeff00112233", GIT_OID_SHA1));
#else
	cl_git_pass(git_odb_open(&odb, "testrepo.git/objects"));
	cl_git_pass(git_oid_fromstr(&one, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
	cl_git_pass(git_oid_fromstr(&two, "00112233445566778899aabbccddeeff00112233"));
#endif

	cl_assert(git_odb_exists(odb, &one));
	cl_assert(!git_odb_exists(odb, &two));

	git_odb_free(odb);
}