Skip to content

Commit 6358320

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 66f9722 commit 6358320

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,9 @@ static int git_parse_source(config_fn_t fn, void *data,
818818
case CONFIG_ERROR_ERROR:
819819
error_return = error("%s", error_msg);
820820
break;
821+
case CONFIG_ERROR_SILENT:
822+
error_return = -1;
823+
break;
821824
case CONFIG_ERROR_UNSET:
822825
BUG("config error action unset");
823826
}

config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct config_options {
5858
CONFIG_ERROR_UNSET = 0, /* use source-specific default */
5959
CONFIG_ERROR_DIE, /* die() on error */
6060
CONFIG_ERROR_ERROR, /* error() on error, return -1 */
61+
CONFIG_ERROR_SILENT, /* return -1 */
6162
} error_action;
6263
};
6364

0 commit comments

Comments
 (0)