[libgit2-glib] Add ggit_config_snapshot
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Add ggit_config_snapshot
- Date: Thu, 30 Jul 2015 22:55:13 +0000 (UTC)
commit 1ba947cc2b2e695283f69c514a2ae018b986829f
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Fri Jul 31 00:54:38 2015 +0200
Add ggit_config_snapshot
libgit2-glib/ggit-config.c | 33 +++++++++++++++++++++++++++++++++
libgit2-glib/ggit-config.h | 3 +++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/ggit-config.c b/libgit2-glib/ggit-config.c
index a00b4e0..18cba01 100644
--- a/libgit2-glib/ggit-config.c
+++ b/libgit2-glib/ggit-config.c
@@ -782,4 +782,37 @@ ggit_config_match_foreach (GgitConfig *config,
error);
}
+/**
+ * ggit_config_snapshot:
+ * @config: a #GgitConfig.
+ * @error: a #GError for error reporting, or %NULL.
+ *
+ * Create a snapshot of the current state of the configuration,
+ * which allows you to look into a consistent view of the configuration
+ * for looking up complex values (e.g. a remote, submodule).
+ *
+ * Returns: (transfer full): a new #GgitConfig, or %NULL if an error occurred.
+ *
+ **/
+GgitConfig *
+ggit_config_snapshot (GgitConfig *config,
+ GError **error)
+{
+ git_config *retconf;
+ gint ret;
+
+ g_return_val_if_fail (GGIT_IS_CONFIG (config), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ ret = git_config_snapshot (&retconf, _ggit_native_get (config));
+
+ if (ret != GIT_OK)
+ {
+ _ggit_error_set (error, ret);
+ return NULL;
+ }
+
+ return _ggit_config_wrap (retconf);
+}
+
/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-config.h b/libgit2-glib/ggit-config.h
index 1f825c9..4013bc0 100644
--- a/libgit2-glib/ggit-config.h
+++ b/libgit2-glib/ggit-config.h
@@ -105,6 +105,9 @@ gboolean ggit_config_match_foreach (GgitConfig *config,
gpointer user_data,
GError **error);
+GgitConfig *ggit_config_snapshot (GgitConfig *config,
+ GError **error);
+
GgitConfig *_ggit_config_wrap (git_config *config);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]