diff options
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/config.h | 13 | ||||
-rw-r--r-- | include/git2/sys/config.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/git2/config.h b/include/git2/config.h index 663b4f6ba..86c4012ed 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -226,6 +226,19 @@ GIT_EXTERN(int) git_config_open_level( */ GIT_EXTERN(int) git_config_open_global(git_config **out, git_config *config); +/** + * Create a snapshot of the configuration + * + * Create a snapshot of the current state of a configuration, which + * allows you to look into a consistent view of the configuration for + * looking up complex values (e.g. a remote, submodule). + * + * @param out pointer in which to store the snapshot config object + * @param config configuration to snapshot + * @return 0 or an error code + */ +GIT_EXTERN(int) git_config_snapshot(git_config **out, git_config *config); + /** * Reload changed config files diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h index 3df2ba327..090588999 100644 --- a/include/git2/sys/config.h +++ b/include/git2/sys/config.h @@ -64,6 +64,8 @@ struct git_config_backend { int (*del_multivar)(struct git_config_backend *, const char *key, const char *regexp); int (*iterator)(git_config_iterator **, struct git_config_backend *); int (*refresh)(struct git_config_backend *); + /** Produce a read-only version of this backend */ + int (*snapshot)(struct git_config_backend **, struct git_config_backend *); void (*free)(struct git_config_backend *); }; #define GIT_CONFIG_BACKEND_VERSION 1 |