Skip to content

Commit 86c0355

Browse files
committed
tests: object: create sandbox
The object::lookup tests do use the "testrepo.git" repository in a read-only way, so we do not set up the repository as a sandbox but simply open it. But in a future commit, we will want to test looking up objects which are corrupted in some way, which requires us to modify the on-disk data. Doing this in a repository without creating the sandbox will modify contents of our libgit2 repository, though. Create the repository in a sandbox to avoid this.
1 parent e29e802 commit 86c0355

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/object/lookup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ static git_repository *g_repo;
66

77
void test_object_lookup__initialize(void)
88
{
9-
cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git")));
9+
g_repo = cl_git_sandbox_init("testrepo.git");
1010
}
1111

1212
void test_object_lookup__cleanup(void)
1313
{
14-
git_repository_free(g_repo);
15-
g_repo = NULL;
14+
cl_git_sandbox_cleanup();
1615
}
1716

1817
void test_object_lookup__lookup_wrong_type_returns_enotfound(void)

0 commit comments

Comments
 (0)