config: add 'origin_type' to config_source struct

Use the config origin_type to print more detailed error messages that
inform the user about the origin of a config error (file, stdin, blob).

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Lars Schneider
2016-02-19 10:16:01 +01:00
committed by Junio C Hamano
parent 7454ee3c62
commit 473166b990
5 changed files with 40 additions and 18 deletions

View File

@ -1485,8 +1485,8 @@ struct git_config_source {
typedef int (*config_fn_t)(const char *, const char *, void *);
extern int git_default_config(const char *, const char *, void *);
extern int git_config_from_file(config_fn_t fn, const char *, void *);
extern int git_config_from_mem(config_fn_t fn, const char *name,
const char *buf, size_t len, void *data);
extern int git_config_from_mem(config_fn_t fn, const char *origin_type,
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 void git_config(config_fn_t fn, void *);
@ -1525,6 +1525,8 @@ extern const char *get_log_output_encoding(void);
extern const char *get_commit_output_encoding(void);
extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);
extern const char *current_config_origin_type(void);
extern const char *current_config_name(void);
struct config_include_data {
int depth;