]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: use config_error_nonbool() instead of custom messages
authorJeff King <peff@peff.net>
Thu, 7 Dec 2023 07:25:16 +0000 (02:25 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Dec 2023 23:26:22 +0000 (08:26 +0900)
A few config callbacks use their own custom messages to report an
unexpected implicit bool like:

  [merge "foo"]
  driver

These should just use config_error_nonbool(), so the user sees
consistent messages.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imap-send.c
merge-ll.c
xdiff-interface.c

index 5b0fe4f95a03852f6175f7deab9f17dc7648dbb5..9c4df7bbc8466bc3ef792aa5277d3616cc151ad2 100644 (file)
@@ -1346,7 +1346,7 @@ static int git_imap_config(const char *var, const char *val,
                server.port = git_config_int(var, val, ctx->kvi);
        else if (!strcmp("imap.host", var)) {
                if (!val) {
-                       return error("Missing value for 'imap.host'");
+                       return config_error_nonbool(var);
                } else {
                        if (starts_with(val, "imap:"))
                                val += 5;
index 8fcf2d3710ed1a87bd851abe04dd22a32fafdf84..1df58ebaac08582d042268f5a07cf5cbd9d7b1c3 100644 (file)
@@ -301,7 +301,7 @@ static int read_merge_config(const char *var, const char *value,
 
        if (!strcmp("driver", key)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                /*
                 * merge.<name>.driver specifies the command line:
                 *
index 05d6475a095c15d665e7ae76c39f35e3d60e973f..d788689d017b04a9b2abfc23a290046de61e4c15 100644 (file)
@@ -314,7 +314,7 @@ int git_xmerge_config(const char *var, const char *value,
 {
        if (!strcmp(var, "merge.conflictstyle")) {
                if (!value)
-                       return error(_("'%s' is not a boolean"), var);
+                       return config_error_nonbool(var);
                if (!strcmp(value, "diff3"))
                        git_xmerge_style = XDL_MERGE_DIFF3;
                else if (!strcmp(value, "zdiff3"))