summaryrefslogtreecommitdiff
path: root/tests/refs
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-03-07 00:30:40 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-16 16:57:30 +0100
commita5815a2afb7f6a0e86d52467b99d06d9bf01a9fb (patch)
tree0f341027c5d9772b58095c1315a978a491dd888f /tests/refs
parent62dd4d71db1408ae03ca7d4d4d2c48f7874a41d9 (diff)
downloadlibgit2-a5815a2afb7f6a0e86d52467b99d06d9bf01a9fb.tar.gz
Add tests for the annotated versions of ref-modifying functions
This also brings the soft-reset tests back to life. The function name was missing an underscore, meaning they had not been running.
Diffstat (limited to 'tests/refs')
-rw-r--r--tests/refs/branches/create.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index d4cf4c29f..31dec0678 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -97,6 +97,7 @@ void test_refs_branches_create__default_reflog_message(void)
git_reflog *log;
git_buf buf = GIT_BUF_INIT;
const git_reflog_entry *entry;
+ git_annotated_commit *annotated;
git_signature *sig;
git_config *cfg;
@@ -116,6 +117,21 @@ void test_refs_branches_create__default_reflog_message(void)
cl_assert_equal_s(git_buf_cstr(&buf), git_reflog_entry_message(entry));
cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
+ cl_git_pass(git_reference_remove(repo, "refs/heads/" NEW_BRANCH_NAME));
+ git_reference_free(branch);
+ git_reflog_free(log);
+ git_buf_clear(&buf);
+
+ cl_git_pass(git_annotated_commit_from_revspec(&annotated, repo, "e90810b8df3"));
+ cl_git_pass(git_branch_create_from_annotated(&branch, repo, NEW_BRANCH_NAME, annotated, true));
+ cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
+
+ entry = git_reflog_entry_byindex(log, 0);
+ cl_git_pass(git_buf_printf(&buf, "branch: Created from e90810b8df3"));
+ cl_assert_equal_s(git_buf_cstr(&buf), git_reflog_entry_message(entry));
+ cl_assert_equal_s(sig->email, git_reflog_entry_committer(entry)->email);
+
+ git_annotated_commit_free(annotated);
git_buf_free(&buf);
git_reflog_free(log);
git_signature_free(sig);