diff options
Diffstat (limited to 'sideband.c')
-rw-r--r-- | sideband.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sideband.c b/sideband.c index 5d8907151f..02805573fa 100644 --- a/sideband.c +++ b/sideband.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "color.h" #include "config.h" @@ -30,28 +32,27 @@ static int use_sideband_colors(void) const char *key = "color.remote"; struct strbuf sb = STRBUF_INIT; - char *value; + const char *value; int i; if (use_sideband_colors_cached >= 0) return use_sideband_colors_cached; - if (!git_config_get_string(key, &value)) { + if (!git_config_get_string_tmp(key, &value)) use_sideband_colors_cached = git_config_colorbool(key, value); - } else if (!git_config_get_string("color.ui", &value)) { + else if (!git_config_get_string_tmp("color.ui", &value)) use_sideband_colors_cached = git_config_colorbool("color.ui", value); - } else { + else use_sideband_colors_cached = GIT_COLOR_AUTO; - } for (i = 0; i < ARRAY_SIZE(keywords); i++) { strbuf_reset(&sb); strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword); - if (git_config_get_string(sb.buf, &value)) - continue; - if (color_parse(value, keywords[i].color)) + if (git_config_get_string_tmp(sb.buf, &value)) continue; + color_parse(value, keywords[i].color); } + strbuf_release(&sb); return use_sideband_colors_cached; } @@ -190,7 +191,7 @@ int demultiplex_sideband(const char *me, int status, int linelen = brk - b; /* - * For message accross packet boundary, there would have + * For message across packet boundary, there would have * a nonempty "scratch" buffer from last call of this * function, and there may have a leading CR/LF in "buf". * For this case we should add a clear-to-eol suffix to |