summaryrefslogtreecommitdiff
path: root/tests-clar/refs/delete.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/refs/delete.c')
-rw-r--r--tests-clar/refs/delete.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests-clar/refs/delete.c b/tests-clar/refs/delete.c
index cc5ab3940..ac517d869 100644
--- a/tests-clar/refs/delete.c
+++ b/tests-clar/refs/delete.c
@@ -3,6 +3,7 @@
#include "repository.h"
#include "git2/reflog.h"
#include "reflog.h"
+#include "ref_helpers.h"
static const char *packed_test_head_name = "refs/heads/packed-test";
static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
@@ -37,10 +38,11 @@ void test_refs_delete__packed_loose(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
/* Ensure it's the loose version that has been found */
- cl_assert(git_reference_is_packed(looked_up_ref) == 0);
+ cl_assert(reference_is_packed(looked_up_ref) == 0);
/* Now that the reference is deleted... */
cl_git_pass(git_reference_delete(looked_up_ref));
+ git_reference_free(looked_up_ref);
/* Looking up the reference once again should not retrieve it */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
@@ -56,6 +58,7 @@ void test_refs_delete__packed_only(void)
{
// can delete a just packed reference
git_reference *ref;
+ git_refdb *refdb;
git_oid id;
const char *new_ref = "refs/heads/new_ref";
@@ -69,17 +72,20 @@ void test_refs_delete__packed_only(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
/* Ensure it's a loose reference */
- cl_assert(git_reference_is_packed(ref) == 0);
+ cl_assert(reference_is_packed(ref) == 0);
/* Pack all existing references */
- cl_git_pass(git_reference_packall(g_repo));
+ cl_git_pass(git_repository_refdb(&refdb, g_repo));
+ cl_git_pass(git_refdb_compress(refdb));
/* Reload the reference from disk */
- cl_git_pass(git_reference_reload(ref));
+ git_reference_free(ref);
+ cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
/* Ensure it's a packed reference */
- cl_assert(git_reference_is_packed(ref) == 1);
+ cl_assert(reference_is_packed(ref) == 1);
/* This should pass */
cl_git_pass(git_reference_delete(ref));
+ git_reference_free(ref);
}