[libgit2-glib] Added ggit_repository_list_tags_match



commit 0629954a5f8ea1f90f195f7c7053acf4a471e02f
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Tue Jun 24 18:23:09 2014 +0200

    Added ggit_repository_list_tags_match

 libgit2-glib/ggit-repository.c |   40 ++++++++++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-repository.h |    4 ++++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 19bb250..1ab5ac9 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -1416,6 +1416,46 @@ ggit_repository_list_tags (GgitRepository  *repository,
 }
 
 /**
+ * ggit_repository_list_tags_match:
+ * @repository: a #GgitRepository.
+ * @pattern: (allow-none): a pattern to match.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Fill a list with all the tags in the @repository matching the provided
+ * pattern. The pattern can use standard fnmatch syntax.
+ *
+ * Returns: (transfer full) (allow-none): a list with matching tags in @repository.
+ **/
+gchar **
+ggit_repository_list_tags_match (GgitRepository  *repository,
+                                 const gchar     *pattern,
+                                 GError         **error)
+{
+       gint ret;
+       git_strarray tag_names;
+       gchar **tags;
+
+       g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
+       g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+       ret = git_tag_list_match (&tag_names,
+                                 pattern ? pattern : "",
+                                 _ggit_native_get (repository));
+
+       if (ret != GIT_OK)
+       {
+               _ggit_error_set (error, ret);
+               tags = NULL;
+       }
+       else
+       {
+               tags = ggit_utils_get_str_array_from_git_strarray (&tag_names);
+       }
+
+       return tags;
+}
+
+/**
  * ggit_repository_delete_tag:
  * @repository: a #GgitRepository.
  * @name: the name of the tag.
diff --git a/libgit2-glib/ggit-repository.h b/libgit2-glib/ggit-repository.h
index e4cb0c9..7c1a982 100644
--- a/libgit2-glib/ggit-repository.h
+++ b/libgit2-glib/ggit-repository.h
@@ -213,6 +213,10 @@ GgitIndexEntry     *ggit_repository_create_index_entry_for_path (
 gchar             **ggit_repository_list_tags         (GgitRepository        *repository,
                                                        GError               **error);
 
+gchar             **ggit_repository_list_tags_match   (GgitRepository        *repository,
+                                                       const gchar           *pattern,
+                                                       GError               **error);
+
 GgitBranch         *ggit_repository_create_branch     (GgitRepository        *repository,
                                                        const gchar           *branch_name,
                                                        GgitObject            *target,


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