summaryrefslogtreecommitdiff
path: root/tests/repo/head.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-03-17 10:21:28 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-03-17 10:21:28 -0400
commit9bbc8f350b80a5a6e94651ec667cf9e5d545b317 (patch)
treea472cf837ffc1dbe7ddb81be0a773ca74f27b7f0 /tests/repo/head.c
parent7800048afbb002d0003b54fcc09c98d0d3249949 (diff)
parent8acf058ff708582e9bbfe04e297d3b17a4d5c2e8 (diff)
downloadlibgit2-9bbc8f350b80a5a6e94651ec667cf9e5d545b317.tar.gz
Merge pull request #2962 from libgit2/cmn/reflog-annotated
Add annotated versions of ref-modying functions
Diffstat (limited to 'tests/repo/head.c')
-rw-r--r--tests/repo/head.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/repo/head.c b/tests/repo/head.c
index b26d6acc7..31c228777 100644
--- a/tests/repo/head.c
+++ b/tests/repo/head.c
@@ -2,6 +2,7 @@
#include "refs.h"
#include "repo_helpers.h"
#include "posix.h"
+#include "git2/annotated_commit.h"
static const char *g_email = "foo@example.com";
static git_repository *repo;
@@ -251,6 +252,7 @@ void test_repo_head__setting_head_updates_reflog(void)
{
git_object *tag;
git_signature *sig;
+ git_annotated_commit *annotated;
cl_git_pass(git_signature_now(&sig, "me", "foo@example.com"));
@@ -264,6 +266,12 @@ void test_repo_head__setting_head_updates_reflog(void)
test_reflog(repo, 1, NULL, "tags/test^{commit}", "foo@example.com", "checkout: moving from unborn to e90810b8df3e80c413d903f631643c716887138d");
test_reflog(repo, 0, "tags/test^{commit}", "refs/heads/haacked", "foo@example.com", "checkout: moving from e90810b8df3e80c413d903f631643c716887138d to haacked");
+ cl_git_pass(git_annotated_commit_from_revspec(&annotated, repo, "haacked~0"));
+ cl_git_pass(git_repository_set_head_detached_from_annotated(repo, annotated));
+
+ test_reflog(repo, 0, NULL, "refs/heads/haacked", "foo@example.com", "checkout: moving from haacked to haacked~0");
+
+ git_annotated_commit_free(annotated);
git_object_free(tag);
git_signature_free(sig);
}