summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/refs/createwithlog.c32
-rw-r--r--tests/refs/reflog/reflog.c9
-rw-r--r--tests/refs/settargetwithlog.c39
3 files changed, 6 insertions, 74 deletions
diff --git a/tests/refs/createwithlog.c b/tests/refs/createwithlog.c
index ff36ffdcd..0fe81df91 100644
--- a/tests/refs/createwithlog.c
+++ b/tests/refs/createwithlog.c
@@ -6,7 +6,6 @@
#include "ref_helpers.h"
static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
-static const char *current_head_target = "refs/heads/master";
static git_repository *g_repo;
@@ -50,34 +49,3 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo
git_reference_free(reference);
git_signature_free(signature);
}
-
-void test_refs_createwithlog__creating_a_symbolic_reference_adds_a_reflog_entry(void)
-{
- git_reference *reference;
- git_oid id;
- git_signature *signature;
- git_reflog *reflog;
- const git_reflog_entry *entry;
-
- const char *name = "ANOTHER_HEAD_TRACKER";
- const char *message = "You've been logged, mate!";
-
- git_oid_fromstr(&id, current_master_tip);
-
- cl_git_pass(git_signature_now(&signature, "foo", "foo@bar"));
-
- cl_git_pass(git_reference_symbolic_create_with_log(&reference, g_repo,
- name, current_head_target, 0, signature, message));
-
- cl_git_pass(git_reflog_read(&reflog, g_repo, name));
- cl_assert_equal_sz(1, git_reflog_entrycount(reflog));
-
- entry = git_reflog_entry_byindex(reflog, 0);
- cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
- cl_assert(git_oid_cmp(&id, &entry->oid_cur) == 0);
- cl_assert_equal_s(message, entry->msg);
-
- git_reflog_free(reflog);
- git_reference_free(reference);
- git_signature_free(signature);
-}
diff --git a/tests/refs/reflog/reflog.c b/tests/refs/reflog/reflog.c
index bcd224270..60085791c 100644
--- a/tests/refs/reflog/reflog.c
+++ b/tests/refs/reflog/reflog.c
@@ -49,17 +49,20 @@ static void assert_appends(const git_signature *committer, const git_oid *oid)
/* Read and parse the reflog for this branch */
cl_git_pass(git_reflog_read(&reflog, repo2, new_ref));
- cl_assert_equal_i(2, (int)git_reflog_entrycount(reflog));
+ cl_assert_equal_i(3, (int)git_reflog_entrycount(reflog));
+
+ /* The first one was the creation of the branch */
+ entry = git_reflog_entry_byindex(reflog, 2);
+ cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
entry = git_reflog_entry_byindex(reflog, 1);
assert_signature(committer, entry->committer);
- cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
+ cl_assert(git_oid_cmp(oid, &entry->oid_old) == 0);
cl_assert(git_oid_cmp(oid, &entry->oid_cur) == 0);
cl_assert(entry->msg == NULL);
entry = git_reflog_entry_byindex(reflog, 0);
assert_signature(committer, entry->committer);
- cl_assert(git_oid_cmp(oid, &entry->oid_old) == 0);
cl_assert(git_oid_cmp(oid, &entry->oid_cur) == 0);
cl_assert_equal_s(commit_msg, entry->msg);
diff --git a/tests/refs/settargetwithlog.c b/tests/refs/settargetwithlog.c
index 99377dad7..cfa1c99d5 100644
--- a/tests/refs/settargetwithlog.c
+++ b/tests/refs/settargetwithlog.c
@@ -53,42 +53,3 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
git_reference_free(reference);
git_signature_free(signature);
}
-
-void test_refs_settargetwithlog__updating_a_symbolic_reference_adds_a_reflog_entry(void)
-{
- git_reference *reference, *reference_out;
- git_oid id;
- git_signature *signature;
- git_reflog *reflog;
- const git_reflog_entry *entry;
-
- const char *name = "HEAD";
- const char *message = "You've been logged, mate!";
-
- git_oid_fromstr(&id, br2_tip);
-
- cl_git_pass(git_signature_now(&signature, "foo", "foo@bar"));
-
- cl_git_pass(git_reference_lookup(&reference, g_repo, name));
-
- cl_assert_equal_s(
- "refs/heads/master", git_reference_symbolic_target(reference));
-
- cl_git_pass(git_reference_symbolic_set_target_with_log(&reference_out,
- reference, br2_name, signature, message));
-
- cl_assert_equal_s(
- br2_name, git_reference_symbolic_target(reference_out));
-
- cl_git_pass(git_reflog_read(&reflog, g_repo, name));
-
- entry = git_reflog_entry_byindex(reflog, 0);
- cl_assert(git_oid_streq(&entry->oid_old, master_tip) == 0);
- cl_assert(git_oid_streq(&entry->oid_cur, br2_tip) == 0);
- cl_assert_equal_s(message, entry->msg);
-
- git_reflog_free(reflog);
- git_reference_free(reference_out);
- git_reference_free(reference);
- git_signature_free(signature);
-}