diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/attr/repo.c | 5 | ||||
-rw-r--r-- | tests/clar_libgit2.c | 8 | ||||
-rw-r--r-- | tests/refs/branches/create.c | 9 | ||||
-rw-r--r-- | tests/refs/branches/delete.c | 7 | ||||
-rw-r--r-- | tests/refs/branches/ishead.c | 24 |
5 files changed, 13 insertions, 40 deletions
diff --git a/tests/attr/repo.c b/tests/attr/repo.c index 9aab7ed96..5e812a72b 100644 --- a/tests/attr/repo.c +++ b/tests/attr/repo.c @@ -9,11 +9,6 @@ static git_repository *g_repo = NULL; void test_attr_repo__initialize(void) { - /* Before each test, instantiate the attr repo from the fixtures and - * rename the .gitted to .git so it is a repo with a working dir. - * Also rename gitattributes to .gitattributes, because it contains - * macro definitions which are only allowed in the root. - */ g_repo = cl_git_sandbox_init("attr"); } diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c index 9ec9a6419..f457adb33 100644 --- a/tests/clar_libgit2.c +++ b/tests/clar_libgit2.c @@ -493,9 +493,11 @@ void cl_fake_home_cleanup(void *payload) GIT_UNUSED(payload); - cl_git_pass(git_libgit2_opts( - GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, restore)); - git__free(restore); + if (restore) { + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, restore)); + git__free(restore); + } } void cl_fake_home(void) diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c index b91eed6e8..38af2f681 100644 --- a/tests/refs/branches/create.c +++ b/tests/refs/branches/create.c @@ -7,10 +7,9 @@ static git_reference *branch; void test_refs_branches_create__initialize(void) { - cl_fixture_sandbox("testrepo.git"); - cl_git_pass(git_repository_open(&repo, "testrepo.git")); - + repo = cl_git_sandbox_init("testrepo.git"); branch = NULL; + target = NULL; } void test_refs_branches_create__cleanup(void) @@ -21,10 +20,8 @@ void test_refs_branches_create__cleanup(void) git_commit_free(target); target = NULL; - git_repository_free(repo); + cl_git_sandbox_cleanup(); repo = NULL; - - cl_fixture_cleanup("testrepo.git"); } static void retrieve_target_from_oid(git_commit **out, git_repository *repo, const char *sha) diff --git a/tests/refs/branches/delete.c b/tests/refs/branches/delete.c index ed5f1627b..e3199e230 100644 --- a/tests/refs/branches/delete.c +++ b/tests/refs/branches/delete.c @@ -10,8 +10,7 @@ void test_refs_branches_delete__initialize(void) { git_oid id; - cl_fixture_sandbox("testrepo.git"); - cl_git_pass(git_repository_open(&repo, "testrepo.git")); + repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL, NULL)); @@ -22,10 +21,8 @@ void test_refs_branches_delete__cleanup(void) git_reference_free(fake_remote); fake_remote = NULL; - git_repository_free(repo); + cl_git_sandbox_cleanup(); repo = NULL; - - cl_fixture_cleanup("testrepo.git"); } void test_refs_branches_delete__can_not_delete_a_branch_pointed_at_by_HEAD(void) diff --git a/tests/refs/branches/ishead.c b/tests/refs/branches/ishead.c index 12a8c4449..d16a79652 100644 --- a/tests/refs/branches/ishead.c +++ b/tests/refs/branches/ishead.c @@ -7,7 +7,8 @@ static git_reference *branch; void test_refs_branches_ishead__initialize(void) { - cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); + repo = cl_git_sandbox_init("testrepo.git"); + branch = NULL; } void test_refs_branches_ishead__cleanup(void) @@ -15,7 +16,7 @@ void test_refs_branches_ishead__cleanup(void) git_reference_free(branch); branch = NULL; - git_repository_free(repo); + cl_git_sandbox_cleanup(); repo = NULL; } @@ -28,34 +29,20 @@ void test_refs_branches_ishead__can_tell_if_a_branch_is_pointed_at_by_HEAD(void) void test_refs_branches_ishead__can_properly_handle_unborn_HEAD(void) { - git_repository_free(repo); - - repo = cl_git_sandbox_init("testrepo.git"); - make_head_unborn(repo, NON_EXISTING_HEAD); cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); cl_assert_equal_i(false, git_branch_is_head(branch)); - - cl_git_sandbox_cleanup(); - repo = NULL; } void test_refs_branches_ishead__can_properly_handle_missing_HEAD(void) { - git_repository_free(repo); - - repo = cl_git_sandbox_init("testrepo.git"); - delete_head(repo); cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master")); cl_assert_equal_i(false, git_branch_is_head(branch)); - - cl_git_sandbox_cleanup(); - repo = NULL; } void test_refs_branches_ishead__can_tell_if_a_branch_is_not_pointed_at_by_HEAD(void) @@ -95,9 +82,6 @@ void test_refs_branches_ishead__only_direct_references_are_considered(void) { git_reference *linked, *super, *head; - git_repository_free(repo); - repo = cl_git_sandbox_init("testrepo.git"); - cl_git_pass(git_reference_symbolic_create(&linked, repo, "refs/heads/linked", "refs/heads/master", 0, NULL, NULL)); cl_git_pass(git_reference_symbolic_create(&super, repo, "refs/heads/super", "refs/heads/linked", 0, NULL, NULL)); cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/heads/super", 1, NULL, NULL)); @@ -111,6 +95,4 @@ void test_refs_branches_ishead__only_direct_references_are_considered(void) git_reference_free(linked); git_reference_free(super); git_reference_free(head); - cl_git_sandbox_cleanup(); - repo = NULL; } |