diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 05:03:06 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 05:03:06 +0000 |
commit | 4ffc4372dff6595a86120ec0bd311c4cb5fb8ed6 (patch) | |
tree | 582224c3f88627b5797d1b57ccaf158c7d36118e /include/git2/sys/config.h | |
parent | Releasing progress-linux version 1.7.2+ds-1~progress7.99u1. (diff) | |
download | libgit2-4ffc4372dff6595a86120ec0bd311c4cb5fb8ed6.tar.xz libgit2-4ffc4372dff6595a86120ec0bd311c4cb5fb8ed6.zip |
Merging upstream version 1.8.1+ds.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/git2/sys/config.h')
-rw-r--r-- | include/git2/sys/config.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h index 0a9005e..75d2075 100644 --- a/include/git2/sys/config.h +++ b/include/git2/sys/config.h @@ -125,6 +125,57 @@ GIT_EXTERN(int) git_config_add_backend( const git_repository *repo, int force); +/** Options for in-memory configuration backends. */ +typedef struct { + unsigned int version; + + /** + * The type of this backend (eg, "command line"). If this is + * NULL, then this will be "in-memory". + */ + const char *backend_type; + + /** + * The path to the origin; if this is NULL then it will be + * left unset in the resulting configuration entries. + */ + const char *origin_path; +} git_config_backend_memory_options; + +#define GIT_CONFIG_BACKEND_MEMORY_OPTIONS_VERSION 1 +#define GIT_CONFIG_BACKEND_MEMORY_OPTIONS_INIT { GIT_CONFIG_BACKEND_MEMORY_OPTIONS_VERSION } + + +/** + * Create an in-memory configuration backend from a string in standard + * git configuration file format. + * + * @param out the new backend + * @param cfg the configuration that is to be parsed + * @param len the length of the string pointed to by `cfg` + * @param opts the options to initialize this backend with, or NULL + */ +extern int git_config_backend_from_string( + git_config_backend **out, + const char *cfg, + size_t len, + git_config_backend_memory_options *opts); + +/** + * Create an in-memory configuration backend from a list of name/value + * pairs. + * + * @param out the new backend + * @param values the configuration values to set (in "key=value" format) + * @param len the length of the values array + * @param opts the options to initialize this backend with, or NULL + */ +extern int git_config_backend_from_values( + git_config_backend **out, + const char **values, + size_t len, + git_config_backend_memory_options *opts); + /** @} */ GIT_END_DECL #endif |