[libgit2-glib] Added ggit_tag_peel
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Added ggit_tag_peel
- Date: Tue, 24 Jun 2014 16:16:41 +0000 (UTC)
commit ae618771a38eddfcfff876d5389b0ffd28747203
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Tue Jun 24 18:15:50 2014 +0200
Added ggit_tag_peel
libgit2-glib/ggit-tag.c | 31 +++++++++++++++++++++++++++++++
libgit2-glib/ggit-tag.h | 3 +++
2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-tag.c b/libgit2-glib/ggit-tag.c
index 80b78bd..bf5bba0 100644
--- a/libgit2-glib/ggit-tag.c
+++ b/libgit2-glib/ggit-tag.c
@@ -197,4 +197,35 @@ ggit_tag_get_target_type (GgitTag *tag)
return ggit_utils_get_gtype_from_otype (git_tag_target_type (_ggit_native_get (tag)));
}
+/**
+ * ggit_tag_peel:
+ * @tag: a #GgitTag.
+ * @error: a #GError.
+ *
+ * Recursively peel a tag until a non tag object is found.
+ *
+ * Returns: (transfer full): a #GgitObject.
+ *
+ **/
+GgitObject *
+ggit_tag_peel (GgitTag *tag,
+ GError **error)
+{
+ git_object *o;
+ gint ret;
+
+ g_return_val_if_fail (GGIT_IS_TAG (tag), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ ret = git_tag_peel (&o, _ggit_native_get (tag));
+
+ if (ret != GIT_OK)
+ {
+ _ggit_error_set (error, ret);
+ return NULL;
+ }
+
+ return ggit_utils_create_real_object (o, TRUE);
+}
+
/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-tag.h b/libgit2-glib/ggit-tag.h
index 2dcaeb9..bb01fa3 100644
--- a/libgit2-glib/ggit-tag.h
+++ b/libgit2-glib/ggit-tag.h
@@ -78,6 +78,9 @@ const gchar *ggit_tag_get_message (GgitTag *tag);
GType ggit_tag_get_target_type (GgitTag *tag);
+GgitObject *ggit_tag_peel (GgitTag *tag,
+ GError **error);
+
G_END_DECLS
#endif /* __GGIT_TAG_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]