[libgit2-glib] Bind git_remote_download



commit 1f2c5eff0b896ec3e246778780d18f40596c6f4f
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Tue Dec 23 17:34:54 2014 +0100

    Bind git_remote_download

 libgit2-glib/ggit-remote.c |   35 +++++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-remote.h |    3 +++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-remote.c b/libgit2-glib/ggit-remote.c
index 60fbf4b..6cc0a18 100644
--- a/libgit2-glib/ggit-remote.c
+++ b/libgit2-glib/ggit-remote.c
@@ -564,6 +564,41 @@ ggit_remote_disconnect (GgitRemote *remote)
 }
 
 /**
+ * ggit_remote_download:
+ * @remote: a #GgitRemote.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Connect to the remote if not yet connected, negotiate with the remote
+ * about which objects are missing and download the resulting packfile and
+ * its index.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ */
+gboolean
+ggit_remote_download (GgitRemote  *remote,
+                      GError     **error)
+{
+       gint ret;
+
+       g_return_val_if_fail (GGIT_IS_REMOTE (remote), FALSE);
+       g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+       reset_transfer_progress (remote, FALSE);
+
+       ret = git_remote_download (_ggit_native_get (remote));
+
+       reset_transfer_progress (remote, TRUE);
+
+       if (ret != GIT_OK)
+       {
+               _ggit_error_set (error, ret);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+/**
  * ggit_remote_add_fetch_spec:
  * @remote: a #GgitRemote.
  * @fetch_spec: the fetch refspec.
diff --git a/libgit2-glib/ggit-remote.h b/libgit2-glib/ggit-remote.h
index b764141..398751a 100644
--- a/libgit2-glib/ggit-remote.h
+++ b/libgit2-glib/ggit-remote.h
@@ -102,6 +102,9 @@ gboolean           ggit_remote_get_connected            (GgitRemote       *remot
 
 void               ggit_remote_disconnect               (GgitRemote       *remote);
 
+gboolean           ggit_remote_download                 (GgitRemote       *remote,
+                                                         GError          **error);
+
 void               ggit_remote_add_fetch_spec           (GgitRemote       *remote,
                                                          const gchar      *fetch_spec,
                                                          GError          **error);


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