[libgit2-glib/wip/adwaitrawat/remote-operations: 1/3] Added ggit_repository_remove_remote



commit e5e07ec535119ae424a9b269dce735f5fdee5252
Author: Adwait Rawat <adwait rawat gmail com>
Date:   Thu Jun 20 02:56:29 2019 +0900

    Added ggit_repository_remove_remote

 libgit2-glib/ggit-repository.c | 32 ++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-repository.h |  4 ++++
 2 files changed, 36 insertions(+)
---
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index 42490f4..282747e 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -2159,6 +2159,38 @@ ggit_repository_create_remote (GgitRepository  *repository,
        return _ggit_remote_wrap (remote);
 }
 
+/**
+ * ggit_repository_remove_remote:
+ * @repository: a #GgitRepository.
+ * @name: the remote's name.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Removes @remote from the @repository.
+ *
+ * Returns: %TRUE if there was no error, %FALSE otherwise
+ */
+gboolean
+ggit_repository_remove_remote (GgitRepository   *repository,
+                               const gchar      *name,
+                               GError          **error)
+{
+       gint ret;
+
+       g_return_val_if_fail (GGIT_IS_REPOSITORY (repository), FALSE);
+       g_return_val_if_fail (name != NULL, FALSE);
+
+       ret = git_remote_delete (_ggit_native_get (repository),
+                                name);
+
+       if (ret != GIT_OK)
+       {
+               _ggit_error_set (error, ret);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
 /**
  * ggit_repository_list_remotes:
  * @repository: a #GgitRepository.
diff --git a/libgit2-glib/ggit-repository.h b/libgit2-glib/ggit-repository.h
index 89a8612..438f7e0 100644
--- a/libgit2-glib/ggit-repository.h
+++ b/libgit2-glib/ggit-repository.h
@@ -267,6 +267,10 @@ GgitRemote         *ggit_repository_create_remote     (GgitRepository        *re
                                                        const gchar           *url,
                                                        GError               **error);
 
+gboolean            ggit_repository_remove_remote     (GgitRepository        *repository,
+                                                       const gchar           *name,
+                                                       GError               **error);
+
 gchar             **ggit_repository_list_remotes      (GgitRepository        *repository,
                                                        GError               **error);
 


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