Commit 67c4716f by Ben Straub

Add passing reflog tests

parent 2952a9d0
...@@ -66,7 +66,6 @@ void test_refs_branches_create__can_force_create_over_an_existing_branch(void) ...@@ -66,7 +66,6 @@ void test_refs_branches_create__can_force_create_over_an_existing_branch(void)
cl_assert_equal_s("refs/heads/br2", git_reference_name(branch)); cl_assert_equal_s("refs/heads/br2", git_reference_name(branch));
} }
void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_EINVALIDSPEC(void) void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_EINVALIDSPEC(void)
{ {
retrieve_known_commit(&target, repo); retrieve_known_commit(&target, repo);
...@@ -75,3 +74,32 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E ...@@ -75,3 +74,32 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
git_branch_create(&branch, repo, "inv@{id", target, 0)); git_branch_create(&branch, repo, "inv@{id", target, 0));
} }
void test_refs_branches_create__creation_creates_new_reflog(void)
{
git_reflog *log;
const git_reflog_entry *entry;
retrieve_known_commit(&target, repo);
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false));
cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
}
void test_refs_branches_create__recreation_updates_existing_reflog(void)
{
git_reflog *log;
const git_reflog_entry *entry;
retrieve_known_commit(&target, repo);
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false));
cl_git_pass(git_branch_delete(branch));
cl_git_pass(git_branch_create(&branch, repo, NEW_BRANCH_NAME, target, false));
cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
cl_assert_equal_i(2, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment