diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-02-02 13:36:58 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-02 13:36:58 -0800 |
commit | 85279e86499501be0f046cb9885ad24fbf9d0b8d (patch) | |
tree | d272cb15ce42c4b57ad685c133a8d1f36e836995 /color.c | |
parent | cc8364c28be5d15787ad4791afa0da49af78d007 (diff) | |
parent | 512aba261a8951a470147b493c720f205638ba14 (diff) | |
download | git-85279e86499501be0f046cb9885ad24fbf9d0b8d.tar.gz |
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.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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; } |