summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2014-01-27 13:47:48 -0800
committerBen Straub <bs@github.com>2014-01-30 15:51:00 -0800
commit67c4716f74f322b79a3e4355c273bc423eb58ec6 (patch)
tree2c7d004546f158f1b883560faf87de1403677029
parent2952a9d0f474547db88f396dd8cc7c62d61993a2 (diff)
downloadlibgit2-67c4716f74f322b79a3e4355c273bc423eb58ec6.tar.gz
Add passing reflog tests
-rw-r--r--tests/refs/branches/create.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index e4ad6683e..43614bd76 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -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));
}
-
void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_EINVALIDSPEC(void)
{
retrieve_known_commit(&target, repo);
@@ -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));
}
+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);
+}
+