[libgit2-glib] Bind ggit_config_open_level



commit e2d4c2206cc0e431f17258e4a04d849b54d48c5a
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Aug 8 18:21:44 2015 +0200

    Bind ggit_config_open_level

 libgit2-glib/ggit-config.c |   33 +++++++++++++++++++++++++++++++++
 libgit2-glib/ggit-config.h |    4 ++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-config.c b/libgit2-glib/ggit-config.c
index 8bfef6a..b6536ce 100644
--- a/libgit2-glib/ggit-config.c
+++ b/libgit2-glib/ggit-config.c
@@ -227,6 +227,39 @@ ggit_config_find_system (void)
 }
 
 /**
+ * ggit_config_open_level:
+ * @config: a #GgitConfig.
+ * @level: the level to open.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Open a specific level config derived from a multi-level one.
+ *
+ * Returns: (transfer full): the configuration at @level, or %NULL.
+ *
+ **/
+GgitConfig *
+ggit_config_open_level (GgitConfig       *config,
+                        GgitConfigLevel   level,
+                        GError          **error)
+{
+       gint ret;
+       git_config *out;
+
+       g_return_val_if_fail (GGIT_IS_CONFIG (config), NULL);
+       g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+       ret = git_config_open_level (&out, _ggit_native_get (config), (git_config_level_t)level);
+
+       if (ret != GIT_OK)
+       {
+               _ggit_error_set (error, ret);
+               return NULL;
+       }
+
+       return _ggit_config_wrap (out);
+}
+
+/**
  * ggit_config_add_file:
  * @config: a #GgitConfig.
  * @file: a #GFile.
diff --git a/libgit2-glib/ggit-config.h b/libgit2-glib/ggit-config.h
index ca01c14..bbbfb00 100644
--- a/libgit2-glib/ggit-config.h
+++ b/libgit2-glib/ggit-config.h
@@ -43,6 +43,10 @@ GgitConfig  *ggit_config_new_from_file (GFile                   *file,
 GFile       *ggit_config_find_global   (void);
 GFile       *ggit_config_find_system   (void);
 
+GgitConfig  *ggit_config_open_level    (GgitConfig               *config,
+                                        GgitConfigLevel           level,
+                                        GError                  **error);
+
 void         ggit_config_add_file      (GgitConfig               *config,
                                         GFile                    *file,
                                         GgitConfigLevel           level,


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