]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: add CONFIG_ERROR_SILENT handler
authorJeff King <peff@peff.net>
Thu, 28 Jun 2018 22:05:09 +0000 (18:05 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Jul 2018 16:35:12 +0000 (09:35 -0700)
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>
config.c
config.h

index a1d445ecbf9de640dca7af9215d9028941a75b2a..ce02ceaf982920d53b1be0e3e2c58ba38e732c84 100644 (file)
--- a/config.c
+++ b/config.c
@@ -818,6 +818,9 @@ static int git_parse_source(config_fn_t fn, void *data,
        case CONFIG_ERROR_ERROR:
                error_return = error("%s", error_msg);
                break;
+       case CONFIG_ERROR_SILENT:
+               error_return = -1;
+               break;
        case CONFIG_ERROR_UNSET:
                BUG("config error action unset");
        }
index ce75bf1e5cc20d149c462b1d467640564083257e..c02809ffdc6e34153de06db7a3f35782118627f1 100644 (file)
--- a/config.h
+++ b/config.h
@@ -58,6 +58,7 @@ struct config_options {
                CONFIG_ERROR_UNSET = 0, /* use source-specific default */
                CONFIG_ERROR_DIE, /* die() on error */
                CONFIG_ERROR_ERROR, /* error() on error, return -1 */
+               CONFIG_ERROR_SILENT, /* return -1 */
        } error_action;
 };