diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-05-18 18:52:16 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-05-21 21:32:59 +0400 |
commit | b81cc1d63bb42dde993979cda49550d2c224d9ed (patch) | |
tree | 0df1056d64b59f7a3b055d3cb058edd8397c9ad8 /tests-clar/object | |
parent | 5b3d52ce37100c1d63229d195041fac3e6f89d28 (diff) |
tag: Introduce git_tag_annotation_create()
Diffstat (limited to 'tests-clar/object')
-rw-r--r-- | tests-clar/object/tag/write.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests-clar/object/tag/write.c b/tests-clar/object/tag/write.c index cd69bea89..68e4b6c61 100644 --- a/tests-clar/object/tag/write.c +++ b/tests-clar/object/tag/write.c @@ -220,3 +220,41 @@ void test_object_tag_write__deleting_with_an_invalid_name_returns_EINVALIDSPEC(v { cl_assert_equal_i(GIT_EINVALIDSPEC, git_tag_delete(g_repo, "Inv@{id")); } + +void create_annotation(git_oid *tag_id, const char *name) +{ + git_object *target; + git_oid target_id; + git_signature *tagger; + + cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); + + git_oid_fromstr(&target_id, tagged_commit); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + + cl_git_pass(git_tag_annotation_create(tag_id, g_repo, name, target, tagger, "boom!")); + git_object_free(target); + git_signature_free(tagger); +} + +void test_object_tag_write__creating_an_annotation_stores_the_new_object_in_the_odb(void) +{ + git_oid tag_id; + git_tag *tag; + + create_annotation(&tag_id, "new_tag"); + + cl_git_pass(git_tag_lookup(&tag, g_repo, &tag_id)); + cl_assert_equal_s("new_tag", git_tag_name(tag)); + + git_tag_free(tag); +} + +void test_object_tag_write__creating_an_annotation_does_not_create_a_reference(void) +{ + git_oid tag_id; + git_reference *tag_ref; + + create_annotation(&tag_id, "new_tag"); + cl_git_fail_with(git_reference_lookup(&tag_ref, g_repo, "refs/tags/new_tag"), GIT_ENOTFOUND); +} |