return 0;
}
-static void get_color(const struct config_location_options *opts,
+static int get_color(const struct config_location_options *opts,
const char *var, const char *def_color)
{
struct get_color_config_data data = {
.get_color_slot = var,
.parsed_color[0] = '\0',
};
+ int ret;
config_with_options(git_get_color_config, &data,
&opts->source, the_repository,
&opts->options);
if (!data.get_color_found && def_color) {
- if (color_parse(def_color, data.parsed_color) < 0)
- die(_("unable to parse default color value"));
+ if (color_parse(def_color, data.parsed_color) < 0) {
+ ret = error(_("unable to parse default color value"));
+ goto out;
+ }
}
+ ret = 0;
+
+out:
fputs(data.parsed_color, stdout);
+ return ret;
}
struct get_colorbool_config_data {
}
else if (actions == ACTION_GET_COLOR) {
check_argc(argc, 1, 2);
- get_color(&location_opts, argv[0], argv[1]);
+ ret = get_color(&location_opts, argv[0], argv[1]);
}
else if (actions == ACTION_GET_COLORBOOL) {
check_argc(argc, 1, 2);