Skip to content

Commit 0dda4ce

Browse files
peffgitster
authored andcommitted
imap-send: don't use git_die_config() inside callback
The point of git_die_config() is to let configset users mention the file/line info for invalid config, like: if (!git_config_get_int("foo.bar", &value)) { if (!is_ok(value)) git_die_config("foo.bar"); } Using it from within a config callback is unnecessary, because we can simply return an error, at which point the config machinery will mention the file/line of the offending variable. Worse, using git_die_config() can actually produce the wrong location when the key is found in multiple spots. For instance, with config like: [imap] host host = foo we'll report the line number of the "host = foo" line, but the problem is on the implicit-bool "host" line. We can fix it by just returning an error code. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 22e2741 commit 0dda4ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

imap-send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ static int git_imap_config(const char *var, const char *val,
13461346
server.port = git_config_int(var, val, ctx->kvi);
13471347
else if (!strcmp("imap.host", var)) {
13481348
if (!val) {
1349-
git_die_config("imap.host", "Missing value for 'imap.host'");
1349+
return error("Missing value for 'imap.host'");
13501350
} else {
13511351
if (starts_with(val, "imap:"))
13521352
val += 5;

0 commit comments

Comments
 (0)