diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-10-20 12:23:48 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-20 12:23:48 -0700 |
commit | b94657683996402228abb1694a5db4792c424f9e (patch) | |
tree | a553b8703be639bf1af8c74946337a5ebe08529f /builtin/config.c | |
parent | b67588d018441d1485378a7d9b460401ba8b76a5 (diff) | |
parent | f6c5a2968c103621adf6928a29e4895361eaa23b (diff) | |
download | git-b94657683996402228abb1694a5db4792c424f9e.tar.gz |
Merge branch 'jn/parse-config-slot'
Code cleanup.
* jn/parse-config-slot:
color_parse: do not mention variable name in error message
pass config slots as pointers instead of offsets
Diffstat (limited to 'builtin/config.c')
-rw-r--r-- | builtin/config.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/config.c b/builtin/config.c index 37305e93e9..8cc2604069 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -296,7 +296,8 @@ static int git_get_color_config(const char *var, const char *value, void *cb) if (!strcmp(var, get_color_slot)) { if (!value) config_error_nonbool(var); - color_parse(value, var, parsed_color); + if (color_parse(value, parsed_color) < 0) + return -1; get_color_found = 1; } return 0; @@ -309,8 +310,10 @@ static void get_color(const char *def_color) git_config_with_options(git_get_color_config, NULL, &given_config_source, respect_includes); - if (!get_color_found && def_color) - color_parse(def_color, "command line", parsed_color); + if (!get_color_found && def_color) { + if (color_parse(def_color, parsed_color) < 0) + die(_("unable to parse default color value")); + } fputs(parsed_color, stdout); } |