[libgit2-glib] Bind ggit_remote_new_anonymous



commit efd39fa1e6aaed8c141902bd632ddc7d6a11b519
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Dec 22 20:24:39 2014 +0100

    Bind ggit_remote_new_anonymous

 libgit2-glib/ggit-remote.c |   39 +++++++++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-remote.h |    5 +++++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-remote.c b/libgit2-glib/ggit-remote.c
index fa5a5f1..cce9d56 100644
--- a/libgit2-glib/ggit-remote.c
+++ b/libgit2-glib/ggit-remote.c
@@ -281,6 +281,45 @@ ggit_remote_new (GgitRepository   *repository,
 }
 
 /**
+ * ggit_remote_new_anonymous:
+ * @repository: a #GgitRepository.
+ * @url: the remote repository's URL.
+ * @fetch: the remote fetchspec.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Creates a remote with the specified refspec in memory. You can use
+ * this when you have a URL instead of a remote's name.
+ *
+ * Returns: (transfer full): a newly allocated #GgitRemote.
+ */
+GgitRemote *
+ggit_remote_new_anonymous (GgitRepository  *repository,
+                           const gchar     *url,
+                           const gchar     *fetch,
+                           GError         **error)
+{
+       gint ret;
+       git_remote *remote;
+
+       g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), NULL);
+       g_return_val_if_fail (url != NULL, NULL);
+       g_return_val_if_fail (fetch != NULL, NULL);
+
+       ret = git_remote_create_anonymous (&remote,
+                                          _ggit_native_get (repository),
+                                          url,
+                                          fetch);
+
+       if (ret != GIT_OK)
+       {
+               _ggit_error_set (error, ret);
+               return NULL;
+       }
+
+       return _ggit_remote_wrap (remote);
+}
+
+/**
  * ggit_remote_save:
  * @remote: a #GgitRemote.
  * @error: a #GError or %NULL.
diff --git a/libgit2-glib/ggit-remote.h b/libgit2-glib/ggit-remote.h
index 47b7224..73d3637 100644
--- a/libgit2-glib/ggit-remote.h
+++ b/libgit2-glib/ggit-remote.h
@@ -76,6 +76,11 @@ GgitRemote        *ggit_remote_new                      (GgitRepository   *repos
                                                          const gchar      *url,
                                                          GError          **error);
 
+GgitRemote        *ggit_remote_new_anonymous            (GgitRepository   *repository,
+                                                         const gchar      *url,
+                                                         const gchar      *fetch,
+                                                         GError          **error);
+
 void               ggit_remote_save                     (GgitRemote       *remote,
                                                          GError          **error);
 


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