Merge branch 'rs/blame-code-cleanup' into maint
[gitweb.git] / color.c
diff --git a/color.c b/color.c
index 1b95e6b2a7bb1601fa5862de8989775e197c7b41..dee61557e03f452f1e20ce6c8c467203aa8aed60 100644 (file)
--- a/color.c
+++ b/color.c
@@ -207,7 +207,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;
        }