summaryrefslogtreecommitdiff
path: root/color.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-02 21:36:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-02 21:36:58 (GMT)
commit85279e86499501be0f046cb9885ad24fbf9d0b8d (patch)
treed272cb15ce42c4b57ad685c133a8d1f36e836995 /color.c
parentcc8364c28be5d15787ad4791afa0da49af78d007 (diff)
parent512aba261a8951a470147b493c720f205638ba14 (diff)
downloadgit-85279e86499501be0f046cb9885ad24fbf9d0b8d.zip
git-85279e86499501be0f046cb9885ad24fbf9d0b8d.tar.gz
git-85279e86499501be0f046cb9885ad24fbf9d0b8d.tar.bz2
Merge branch 'nd/log-graph-configurable-colors'
Some people feel the default set of colors used by "git log --graph" rather limiting. A mechanism to customize the set of colors has been introduced. * nd/log-graph-configurable-colors: document behavior of empty color name color_parse_mem: allow empty color spec log --graph: customize the graph lines with config log.graphColors color.c: trim leading spaces in color_parse_mem() color.c: fix color_parse_mem() with value_len == 0
Diffstat (limited to 'color.c')
-rw-r--r--color.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/color.c b/color.c
index 1b95e6b..dee6155 100644
--- 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;
}