diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-05-13 17:44:39 +0200 |
---|---|---|
committer | Carlos MartÃn Nieto <cmn@dwim.me> | 2013-11-23 13:34:51 +0100 |
commit | 56ad3782e08cd1b2d26eee4014e77fac7a6c2414 (patch) | |
tree | 43dd76b4ffbf4ab2b8791834b91943df1253ee23 /tests/refs/createwithlog.c | |
parent | bba25f39a29c7913bab97fa6e8ac2ccb78ea33b6 (diff) | |
download | libgit2-56ad3782e08cd1b2d26eee4014e77fac7a6c2414.tar.gz |
refs: Introduce git_reference_symbolic_create_with_log()
Diffstat (limited to 'tests/refs/createwithlog.c')
-rw-r--r-- | tests/refs/createwithlog.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/refs/createwithlog.c b/tests/refs/createwithlog.c index 10e10cec8..34ab8067f 100644 --- a/tests/refs/createwithlog.c +++ b/tests/refs/createwithlog.c @@ -50,3 +50,34 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo git_reference_free(reference); git_signature_free(signature); } + +void test_refs_createwithlog__creating_a_symbolic_reference_adds_a_reflog_entry(void) +{ + git_reference *reference; + git_oid id; + git_signature *signature; + git_reflog *reflog; + const git_reflog_entry *entry; + + const char *name = "ANOTHER_HEAD_TRACKER"; + const char *message = "You've been logged, mate!"; + + git_oid_fromstr(&id, current_master_tip); + + cl_git_pass(git_signature_now(&signature, "foo", "foo@bar")); + + cl_git_pass(git_reference_symbolic_create_with_log(&reference, g_repo, + name, current_head_target, 0, signature, message)); + + cl_git_pass(git_reflog_read(&reflog, reference)); + cl_assert_equal_sz(1, git_reflog_entrycount(reflog)); + + entry = git_reflog_entry_byindex(reflog, 0); + cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0); + cl_assert(git_oid_cmp(&id, &entry->oid_cur) == 0); + cl_assert_equal_s(message, entry->msg); + + git_reflog_free(reflog); + git_reference_free(reference); + git_signature_free(signature); +} |