summaryrefslogtreecommitdiff
path: root/tests/refs
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2014-01-28 11:45:30 -0800
committerBen Straub <bs@github.com>2014-01-30 15:53:52 -0800
commit59bb1126e0a6d5c004f3856e23c75ae440211f1c (patch)
tree8eb9f1f05a0016aa9660ceb588f554ff4395c998 /tests/refs
parente871d89b2862ea61a13019705d4074bfcb6b88ae (diff)
downloadlibgit2-59bb1126e0a6d5c004f3856e23c75ae440211f1c.tar.gz
Provide good default reflog messages in branch api
Diffstat (limited to 'tests/refs')
-rw-r--r--tests/refs/branches/create.c17
-rw-r--r--tests/refs/branches/move.c21
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index 0c0fdb013..32e17d600 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -86,4 +86,21 @@ void test_refs_branches_create__creation_creates_new_reflog(void)
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("create!", git_reflog_entry_message(entry));
+
+ git_reflog_free(log);
+}
+
+void test_refs_branches_create__default_reflog_message(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, NULL, NULL));
+ cl_git_pass(git_reflog_read(&log, repo, "refs/heads/" NEW_BRANCH_NAME));
+
+ entry = git_reflog_entry_byindex(log, 0);
+ cl_assert_equal_s("Branch: created", git_reflog_entry_message(entry));
+
+ git_reflog_free(log);
}
diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c
index 0bdb58a5f..622921d4f 100644
--- a/tests/refs/branches/move.c
+++ b/tests/refs/branches/move.c
@@ -205,3 +205,24 @@ void test_refs_branches_move__updates_the_reflog(void)
git_reference_free(new_branch);
git_reflog_free(log);
}
+
+void test_refs_branches_move__default_reflog_message(void)
+{
+ git_reference *branch;
+ git_reference *new_branch;
+ git_reflog *log;
+ const git_reflog_entry *entry;
+
+ cl_git_pass(git_reference_lookup(&branch, repo, "refs/heads/master"));
+ cl_git_pass(git_branch_move(&new_branch, branch, "master2", 0, NULL, NULL));
+
+ cl_git_pass(git_reflog_read(&log, repo, git_reference_name(new_branch)));
+ entry = git_reflog_entry_byindex(log, 0);
+ cl_assert_equal_s("Branch: renamed refs/heads/master to refs/heads/master2",
+ git_reflog_entry_message(entry));
+
+ git_reference_free(branch);
+ git_reference_free(new_branch);
+ git_reflog_free(log);
+
+}