/** * ggit_tag_get_target: * @tag: a #GgitTag. * @error: a #GError for error reporting, or %NULL. * * Gets the target #GgitObject of @tag. * * This method performs a repository lookup for the * given object and returns it. * * Returns: (transfer full): the target #GgitObject of the tag. */ GgitObject * ggit_tag_get_target (GgitTag *tag, GError **error) { GgitObject *object = NULL; git_tag *t; git_object *obj; gint ret; g_return_val_if_fail (GGIT_IS_TAG (tag), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); t = _ggit_native_get (tag); ret = git_tag_target (&obj, t); if (ret != GIT_OK) { _ggit_error_set (error, ret); } else { object = ggit_utils_create_real_object (obj, TRUE); } return object; }
/** * ggit_tag_get_target: * @tag: a #GgitTag. * @error: a #GError for error reporting, or %NULL. * * Gets the target #GgitObject of @tag. * * This method performs a repository lookup for the * given object and returns it. * * Returns: (transfer full): the target #GgitObject of the tag. */ GgitObject * ggit_tag_get_target (GgitTag *tag, GError **error) { GgitObject *object = NULL; git_tag *t; git_object *obj; gint ret; g_return_val_if_fail (GGIT_IS_TAG (tag), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); t = (git_tag *)GGIT_OBJECT (tag)->priv->obj; ret = git_tag_target (&obj, t); if (ret != GIT_SUCCESS) { _ggit_error_set (error, ret); } else { object = ggit_utils_create_real_object (obj); } return object; }
/** * ggit_ref_lookup: * @ref: a #GgitRef. * @error: a #GError for error reporting, or %NULL. * * Convenient method to resolve a reference to an object. * * Returns: (transfer full): a #GgitObject. * **/ GgitObject * ggit_ref_lookup (GgitRef *ref, GError **error) { git_object *obj; git_reference *r; gint ret; GgitRef *lref; g_return_val_if_fail (GGIT_IS_REF (ref), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); lref = ggit_ref_resolve (ref, error); if (lref == NULL) { return NULL; } r = _ggit_native_get (lref); ret = git_object_lookup (&obj, git_reference_owner (r), git_reference_target (r), GIT_OBJ_ANY); g_object_unref (lref); if (ret != GIT_OK) { _ggit_error_set (error, ret); return NULL; } return ggit_utils_create_real_object (obj, TRUE); }