diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-09-02 13:24:17 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-02 13:24:18 -0700 |
commit | 56f214e0716dec043b50a7e1e8cc181be2ef7df2 (patch) | |
tree | 9233df7f61bba4048b92768a07b97db9ecb7b2d3 /cache.h | |
parent | e8e4ce72cd9ebb5e5dfe580f98b7764ca6dc08ea (diff) | |
parent | 4c715ebb96acc77008e9cbebc381738611c6006f (diff) | |
download | git-56f214e0716dec043b50a7e1e8cc181be2ef7df2.tar.gz |
Merge branch 'ta/config-set'
Add in-core caching layer to let us avoid reading the same
configuration files number of times.
* ta/config-set:
test-config: add tests for the config_set API
add `config_set` API for caching config-like files
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -1353,6 +1353,38 @@ extern int parse_config_key(const char *var, const char **subsection, int *subsection_len, const char **key); +struct config_set { + struct hashmap config_hash; + int hash_initialized; +}; + +extern void git_configset_init(struct config_set *cs); +extern int git_configset_add_file(struct config_set *cs, const char *filename); +extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value); +extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key); +extern void git_configset_clear(struct config_set *cs); +extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest); +extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest); +extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest); +extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest); +extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest); +extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest); +extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest); +extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest); + +extern int git_config_get_value(const char *key, const char **value); +extern const struct string_list *git_config_get_value_multi(const char *key); +extern void git_config_clear(void); +extern void git_config_iter(config_fn_t fn, void *data); +extern int git_config_get_string_const(const char *key, const char **dest); +extern int git_config_get_string(const char *key, char **dest); +extern int git_config_get_int(const char *key, int *dest); +extern int git_config_get_ulong(const char *key, unsigned long *dest); +extern int git_config_get_bool(const char *key, int *dest); +extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest); +extern int git_config_get_maybe_bool(const char *key, int *dest); +extern int git_config_get_pathname(const char *key, const char **dest); + extern int committer_ident_sufficiently_given(void); extern int author_ident_sufficiently_given(void); |