config: add CONFIG_ERROR_SILENT handler
We can currently die() or error(), but there's not yet any way for callers to ask us just to quietly return an error. Let's give them one. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 28, 2018 at 18:05 UTC
63583203df51c645aa2bf2988bbdfa3d308ef517
2 files changed
+4
config.c
+3
@@ -818,6 +818,9 @@ static int git_parse_source(config_fn_t fn, void *data,
818
case CONFIG_ERROR_ERROR:
819
error_return = error("%s", error_msg);
820
break;
821
+ case CONFIG_ERROR_SILENT:
822
+ error_return = -1;
823
+ break;
824
case CONFIG_ERROR_UNSET:
825
BUG("config error action unset");
826
}
config.h
+1
@@ -58,6 +58,7 @@ struct config_options {
58
CONFIG_ERROR_UNSET = 0, /* use source-specific default */
59
CONFIG_ERROR_DIE, /* die() on error */
60
CONFIG_ERROR_ERROR, /* error() on error, return -1 */
61
+ CONFIG_ERROR_SILENT, /* return -1 */
62
} error_action;
63
};
64