[libgit2-glib] Add ggit_repository_create_tag_annotation



commit 7499bd466925fc22fcd71ef11f81fa6466ceb3ff
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Tue Jun 24 17:48:21 2014 +0200

    Add ggit_repository_create_tag_annotation

 libgit2-glib/ggit-repository.c |   49 ++++++++++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-repository.h |    8 ++++++
 2 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 1eb6c0d..d46a621 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -1331,6 +1331,55 @@ ggit_repository_create_tag_lightweight (GgitRepository   *repository,
 }
 
 /**
+ * ggit_repository_create_tag_annotation:
+ * @repository: a #GgitRepository.
+ * @tag_name: the name of the tag.
+ * @target: a #GgitObject.
+ * @signature: a #GgitObject.
+ * @message: the tag message.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Creates a new annotated tag.
+ *
+ * Returns: (transfer full) (allow-none): the id to which the tag points, or
+ *                                        %NULL in case of an error.
+ *
+ **/
+GgitOId *
+ggit_repository_create_tag_annotation (GgitRepository  *repository,
+                                       const gchar     *tag_name,
+                                       GgitObject      *target,
+                                       GgitSignature   *signature,
+                                       const gchar     *message,
+                                       GError         **error)
+{
+       git_oid oid;
+       gint ret;
+
+       g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
+       g_return_val_if_fail (tag_name != NULL, FALSE);
+       g_return_val_if_fail (GGIT_IS_OBJECT (target), FALSE);
+       g_return_val_if_fail (GGIT_IS_SIGNATURE (signature), FALSE);
+       g_return_val_if_fail (message != NULL, FALSE);
+       g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+       ret = git_tag_annotation_create (&oid,
+                                        _ggit_native_get (repository),
+                                        tag_name,
+                                        _ggit_native_get (target),
+                                        _ggit_native_get (signature),
+                                        message);
+
+       if (ret != GIT_OK)
+       {
+               _ggit_error_set (error, ret);
+               return NULL;
+       }
+
+       return _ggit_oid_wrap (&oid);
+}
+
+/**
  * ggit_repository_list_tags:
  * @repository: a #GgitRepository.
  * @error: a #GError for error reporting, or %NULL.
diff --git a/libgit2-glib/ggit-repository.h b/libgit2-glib/ggit-repository.h
index dcf65f4..08f4667 100644
--- a/libgit2-glib/ggit-repository.h
+++ b/libgit2-glib/ggit-repository.h
@@ -173,6 +173,14 @@ GgitOId            *ggit_repository_create_tag_lightweight (
                                                        GgitCreateFlags        flags,
                                                        GError               **error);
 
+GgitOId            *ggit_repository_create_tag_annotation (
+                                                       GgitRepository        *repository,
+                                                       const gchar           *tag_name,
+                                                       GgitObject            *target,
+                                                       GgitSignature         *signature,
+                                                       const gchar           *message,
+                                                       GError               **error);
+
 gboolean            ggit_repository_delete_tag        (GgitRepository        *repository,
                                                        const gchar           *name,
                                                        GError               **error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]