diff --git a/color.c b/color.c index fc0b72ad59..54a3da1bad 100644 --- a/color.c +++ b/color.c @@ -115,7 +115,7 @@ void color_parse(const char *value, const char *var, char *dst) *dst = 0; return; bad: - die("bad config value '%s' for variable '%s'", value, var); + die("bad color value '%s' for variable '%s'", value, var); } int git_config_colorbool(const char *var, const char *value, int stdout_is_tty) @@ -191,3 +191,10 @@ int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...) va_end(args); return r; } + +void color_parse_mem(const char *value, int len, const char *var, char *dst) +{ + char *tmp = xmemdupz(value, len); + color_parse(tmp, var, dst); + free(tmp); +} diff --git a/color.h b/color.h index 6cf5c88aaf..70660999df 100644 --- a/color.h +++ b/color.h @@ -16,7 +16,8 @@ extern int git_use_color_default; int git_color_default_config(const char *var, const char *value, void *cb); int git_config_colorbool(const char *var, const char *value, int stdout_is_tty); -void color_parse(const char *var, const char *value, char *dst); +void color_parse(const char *value, const char *var, char *dst); +void color_parse_mem(const char *value, int len, const char *var, char *dst); int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);