diff options
Diffstat (limited to 'color.c')
-rw-r--r-- | color.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,4 +1,5 @@ #include "cache.h" +#include "config.h" #include "color.h" static int git_use_color_default = GIT_COLOR_AUTO; @@ -207,7 +208,17 @@ int color_parse_mem(const char *value, int value_len, char *dst) struct color fg = { COLOR_UNSPECIFIED }; struct color bg = { COLOR_UNSPECIFIED }; - if (!strncasecmp(value, "reset", len)) { + while (len > 0 && isspace(*ptr)) { + ptr++; + len--; + } + + if (!len) { + dst[0] = '\0'; + return 0; + } + + if (!strncasecmp(ptr, "reset", len)) { xsnprintf(dst, end - dst, GIT_COLOR_RESET); return 0; } @@ -350,14 +361,6 @@ int git_color_config(const char *var, const char *value, void *cb) return 0; } -int git_color_default_config(const char *var, const char *value, void *cb) -{ - if (git_color_config(var, value, cb) < 0) - return -1; - - return git_default_config(var, value, cb); -} - void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb) { if (*color) |