Skip to content

Commit b6ed67c

Browse files
committed
tests: refs::crashes: create sandbox for creating symref
The test `refs::crashes::double_free` operates on our in-source "testrepo.git" repository without creating a copy first. As the test will try to create a new symbolic reference, this will fail when we want to do a pure out-of-tree build with a read-only source tree. Fix the issue by creating a sandbox first.
1 parent 6ee7d37 commit b6ed67c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/refs/crashes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ void test_refs_crashes__double_free(void)
66
git_reference *ref, *ref2;
77
const char *REFNAME = "refs/heads/xxx";
88

9-
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
9+
repo = cl_git_sandbox_init("testrepo.git");
1010
cl_git_pass(git_reference_symbolic_create(&ref, repo, REFNAME, "refs/heads/master", 0, NULL));
1111
cl_git_pass(git_reference_lookup(&ref2, repo, REFNAME));
1212
cl_git_pass(git_reference_delete(ref));
@@ -16,5 +16,5 @@ void test_refs_crashes__double_free(void)
1616
/* reference is gone from disk, so reloading it will fail */
1717
cl_git_fail(git_reference_lookup(&ref2, repo, REFNAME));
1818

19-
git_repository_free(repo);
19+
cl_git_sandbox_cleanup();
2020
}

0 commit comments

Comments
 (0)