Merge branch 'ta/config-set-1'
Use the new caching config-set API in git_config() calls. * ta/config-set-1: add tests for `git_config_get_string_const()` add a test for semantic errors in config files rewrite git_config() to use the config-set API config: add `git_die_config()` to the config-set API change `git_config()` return value to void add line number and file name info to `config_set` config.c: fix accuracy of line number in errors config.c: mark error and warnings strings for translation
This commit is contained in:
34
cache.h
34
cache.h
@ -8,6 +8,7 @@
|
||||
#include "gettext.h"
|
||||
#include "convert.h"
|
||||
#include "trace.h"
|
||||
#include "string-list.h"
|
||||
|
||||
#include SHA1_HEADER
|
||||
#ifndef git_SHA_CTX
|
||||
@ -1296,7 +1297,7 @@ extern int git_config_from_buf(config_fn_t fn, const char *name,
|
||||
const char *buf, size_t len, void *data);
|
||||
extern void git_config_push_parameter(const char *text);
|
||||
extern int git_config_from_parameters(config_fn_t fn, void *data);
|
||||
extern int git_config(config_fn_t fn, void *);
|
||||
extern void git_config(config_fn_t fn, void *);
|
||||
extern int git_config_with_options(config_fn_t fn, void *,
|
||||
struct git_config_source *config_source,
|
||||
int respect_includes);
|
||||
@ -1353,9 +1354,32 @@ extern int parse_config_key(const char *var,
|
||||
const char **subsection, int *subsection_len,
|
||||
const char **key);
|
||||
|
||||
struct config_set_element {
|
||||
struct hashmap_entry ent;
|
||||
char *key;
|
||||
struct string_list value_list;
|
||||
};
|
||||
|
||||
struct configset_list_item {
|
||||
struct config_set_element *e;
|
||||
int value_index;
|
||||
};
|
||||
|
||||
/*
|
||||
* the contents of the list are ordered according to their
|
||||
* position in the config files and order of parsing the files.
|
||||
* (i.e. key-value pair at the last position of .git/config will
|
||||
* be at the last item of the list)
|
||||
*/
|
||||
struct configset_list {
|
||||
struct configset_list_item *items;
|
||||
unsigned int nr, alloc;
|
||||
};
|
||||
|
||||
struct config_set {
|
||||
struct hashmap config_hash;
|
||||
int hash_initialized;
|
||||
struct configset_list list;
|
||||
};
|
||||
|
||||
extern void git_configset_init(struct config_set *cs);
|
||||
@ -1385,6 +1409,14 @@ 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);
|
||||
|
||||
struct key_value_info {
|
||||
const char *filename;
|
||||
int linenr;
|
||||
};
|
||||
|
||||
extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));
|
||||
extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);
|
||||
|
||||
extern int committer_ident_sufficiently_given(void);
|
||||
extern int author_ident_sufficiently_given(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user