[libgit2-glib] Bind ggit_submodule_open
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Bind ggit_submodule_open
- Date: Sat, 13 Dec 2014 12:27:08 +0000 (UTC)
commit bb893bbb8b1602bb3b01e950704ec40a14a53210
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Dec 13 13:26:08 2014 +0100
Bind ggit_submodule_open
libgit2-glib/ggit-submodule.c | 33 +++++++++++++++++++++++++++++++++
libgit2-glib/ggit-submodule.h | 3 +++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-submodule.c b/libgit2-glib/ggit-submodule.c
index 8774699..3a4deec 100644
--- a/libgit2-glib/ggit-submodule.c
+++ b/libgit2-glib/ggit-submodule.c
@@ -84,6 +84,39 @@ ggit_submodule_unref (GgitSubmodule *submodule)
}
/**
+ * ggit_submodule_open:
+ * @submodule: a #GgitSubmodule.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Open the repository for a submodule. Multiple calls to this function
+ * will return distinct #GgitRepository objects. Only submodules which are
+ * checked out in the working directory can be opened.
+ *
+ * Returns: (transfer full): the opened #GgitRepository or %NULL in case of an
+ * error.
+ */
+GgitRepository *
+ggit_submodule_open (GgitSubmodule *submodule,
+ GError **error)
+{
+ git_repository *repo;
+ gint ret;
+
+ g_return_if_fail (submodule != NULL);
+ g_return_if_fail (error == NULL || *error == NULL);
+
+ ret = git_submodule_open (&repo, submodule->submodule);
+
+ if (ret != GIT_OK)
+ {
+ _ggit_error_set (error, ret);
+ return NULL;
+ }
+
+ return _ggit_repository_wrap (repo, TRUE);
+}
+
+/**
* ggit_submodule_save:
* @submodule: a #GgitSubmodule.
* @error: a #GError for error reporting, or %NULL.
diff --git a/libgit2-glib/ggit-submodule.h b/libgit2-glib/ggit-submodule.h
index c79dce3..c4433b1 100644
--- a/libgit2-glib/ggit-submodule.h
+++ b/libgit2-glib/ggit-submodule.h
@@ -38,6 +38,9 @@ GgitSubmodule *_ggit_submodule_wrap (const git_submodul
GgitSubmodule *ggit_submodule_ref (GgitSubmodule *submodule);
void ggit_submodule_unref (GgitSubmodule *submodule);
+GgitRepository *ggit_submodule_open (GgitSubmodule *submodule,
+ GError **error);
+
void ggit_submodule_save (GgitSubmodule *submodule,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]