static VALUE rb_git_tag_tagger_GET(VALUE self) { git_tag *tag; RUGGED_OBJ_UNWRAP(self, git_tag, tag); return rugged_signature_new(git_tag_tagger(tag)); }
PyObject * Tag_tagger__get__(Tag *self) { const git_signature *signature = git_tag_tagger(self->tag); if (!signature) Py_RETURN_NONE; return build_signature((Object*)self, signature, "utf-8"); }
static VALUE rb_git_tag_tagger_GET(VALUE self) { git_tag *tag; git_person *person; Data_Get_Struct(self, git_tag, tag); person = (git_person *)git_tag_tagger(tag); return rugged_person_c2rb(person); }
Tagger* Tag::getTagger() { Tagger *tagger = nullptr; if (tag) { const git_signature *sig = git_tag_tagger(tag); tagger = new Tagger(sig); } return tagger; }
static void show_tag(const git_tag *tag) { char oidstr[GIT_OID_HEXSZ + 1]; git_oid_tostr(oidstr, sizeof(oidstr), git_tag_target_id(tag));; printf("object %s\n", oidstr); printf("type %s\n", git_object_type2string(git_tag_target_type(tag))); printf("tag %s\n", git_tag_name(tag)); print_signature("tagger", git_tag_tagger(tag)); if (git_tag_message(tag)) printf("\n%s\n", git_tag_message(tag)); }
emacs_value egit_tag_tagger(emacs_env *env, emacs_value _tag) { EGIT_ASSERT_TAG(_tag); git_tag *tag = EGIT_EXTRACT(_tag); const git_signature *sig = git_tag_tagger(tag); // Copy the signature so it can live independently from the commit git_signature *ret; int retval = git_signature_dup(&ret, sig); EGIT_CHECK_ERROR(retval); return egit_wrap(env, EGIT_SIGNATURE, ret, NULL); }
/* * call-seq: * annotation.tagger -> signature * * Return the signature for the author of this tag +annotation+. The signature * is returned as a +Hash+ containing +:name+, +:email+ of the author * and +:time+ of the tagging. * * annotation.tagger #=> {:email=>"*****@*****.**", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"} */ static VALUE rb_git_tag_annotation_tagger(VALUE self) { git_tag *tag; const git_signature *tagger; Data_Get_Struct(self, git_tag, tag); tagger = git_tag_tagger(tag); if (!tagger) return Qnil; return rugged_signature_new(tagger, NULL); }
/** * ggit_tag_get_tagger: * @tag: a #GgitTag. * * Get the tagger (author) of @tag. The returned value must be free with * g_object_unref(). * * Returns: (transfer full): the tagger (author) of the tag. */ GgitSignature * ggit_tag_get_tagger (GgitTag *tag) { const git_signature *signature; git_tag *t; g_return_val_if_fail (GGIT_IS_TAG (tag), NULL); t = _ggit_native_get (tag); signature = git_tag_tagger (t); return _ggit_signature_wrap ((git_signature *)signature, NULL, FALSE); }
/** * ggit_tag_get_tagger: * @tag: a #GgitTag. * * Get the tagger (author) of @tag. The returned value must be free with * ggit_signature_free(). * * Returns: (transfer full): the tagger (author) of the tag. */ GgitSignature * ggit_tag_get_tagger (GgitTag *tag) { const git_signature *signature; git_tag *t; g_return_val_if_fail (GGIT_IS_TAG (tag), NULL); t = (git_tag *)GGIT_OBJECT (tag)->priv->obj; signature = git_tag_tagger (t); return _ggit_signature_wrap ((git_signature *)signature); }
void test_object_tag_write__basic(void) { // write a tag to the repository and read it again git_tag *tag; git_oid target_id, tag_id; git_signature *tagger; const git_signature *tagger1; git_reference *ref_tag; git_object *target; git_oid_fromstr(&target_id, tagged_commit); cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); /* create signature */ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); cl_git_pass( git_tag_create(&tag_id, g_repo, "the-tag", target, tagger, tagger_message, 0) ); git_object_free(target); git_signature_free(tagger); cl_git_pass(git_tag_lookup(&tag, g_repo, &tag_id)); cl_assert(git_oid_cmp(git_tag_target_oid(tag), &target_id) == 0); /* Check attributes were set correctly */ tagger1 = git_tag_tagger(tag); cl_assert(tagger1 != NULL); cl_assert_equal_s(tagger1->name, tagger_name); cl_assert_equal_s(tagger1->email, tagger_email); cl_assert(tagger1->when.time == 123456789); cl_assert(tagger1->when.offset == 60); cl_assert_equal_s(git_tag_message(tag), tagger_message); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag")); cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0); cl_git_pass(git_reference_delete(ref_tag)); git_tag_free(tag); }
/** * Init slots in S4 class git_tag * * @param source a tag * @param repo S4 class git_repository that contains the tag * @param dest S4 class git_tag to initialize * @return void */ void git2r_tag_init(git_tag *source, SEXP repo, SEXP dest) { const git_signature *tagger; const git_oid *oid; char sha[GIT_OID_HEXSZ + 1]; char target[GIT_OID_HEXSZ + 1]; oid = git_tag_id(source); git_oid_tostr(sha, sizeof(sha), oid); SET_SLOT(dest, Rf_install("sha"), mkString(sha)); SET_SLOT(dest, Rf_install("message"), mkString(git_tag_message(source))); SET_SLOT(dest, Rf_install("name"), mkString(git_tag_name(source))); tagger = git_tag_tagger(source); if (tagger) git2r_signature_init(tagger, GET_SLOT(dest, Rf_install("tagger"))); oid = git_tag_target_id(source); git_oid_tostr(target, sizeof(target), oid);; SET_SLOT(dest, Rf_install("target"), mkString(target)); SET_SLOT(dest, Rf_install("repo"), repo); }
must_pass(git_tag_create( &tag_id, /* out id */ repo, "the-tag", &target_id, GIT_OBJ_COMMIT, tagger, TAGGER_MESSAGE)); git_signature_free((git_signature *)tagger); must_pass(git_tag_lookup(&tag, repo, &tag_id)); must_be_true(git_oid_cmp(git_tag_target_oid(tag), &target_id) == 0); /* Check attributes were set correctly */ tagger = git_tag_tagger(tag); must_be_true(tagger != NULL); must_be_true(strcmp(tagger->name, TAGGER_NAME) == 0); must_be_true(strcmp(tagger->email, TAGGER_EMAIL) == 0); must_be_true(tagger->when.time == 123456789); must_be_true(tagger->when.offset == 60); must_be_true(strcmp(git_tag_message(tag), TAGGER_MESSAGE) == 0); must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/the-tag")); must_be_true(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0); must_pass(git_reference_delete(ref_tag)); must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tag)); git_tag_close(tag);