summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-06-28 22:05:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-03 16:33:03 (GMT)
commit66f9722882993f60be656afaae4c5c9ac92957e9 (patch)
tree7e546e5510b69ec315fb92fb25838dba0d6793f8 /config.h
parente3331758f12da22f4103eec7efe1b5304a9be5e9 (diff)
downloadgit-66f9722882993f60be656afaae4c5c9ac92957e9.zip
git-66f9722882993f60be656afaae4c5c9ac92957e9.tar.gz
git-66f9722882993f60be656afaae4c5c9ac92957e9.tar.bz2
config: turn die_on_error into caller-facing enum
The config code has a die_on_error flag, which lets us emit an error() instead of dying when we see a bogus config file. But there's no way for a caller of the config code to set this: it's auto-set based on whether we're reading a file or a blob. Instead, let's add it to the config_options struct. When it's not set (or we have no options) we'll continue to fall back to the existing file/blob behavior. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.h')
-rw-r--r--config.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/config.h b/config.h
index 626d465..ce75bf1 100644
--- a/config.h
+++ b/config.h
@@ -54,6 +54,11 @@ struct config_options {
const char *git_dir;
config_parser_event_fn_t event_fn;
void *event_fn_data;
+ enum config_error_action {
+ CONFIG_ERROR_UNSET = 0, /* use source-specific default */
+ CONFIG_ERROR_DIE, /* die() on error */
+ CONFIG_ERROR_ERROR, /* error() on error, return -1 */
+ } error_action;
};
typedef int (*config_fn_t)(const char *, const char *, void *);