MCPcopy Create free account
hub / github.com/git/git / init_color

Function init_color

add-patch.c:288–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286};
287
288static void init_color(struct repository *r,
289 enum git_colorbool use_color,
290 const char *section_and_slot, char *dst,
291 const char *default_color)
292{
293 char *key = xstrfmt("color.%s", section_and_slot);
294 const char *value;
295
296 if (!want_color(use_color))
297 dst[0] = '\0';
298 else if (repo_config_get_value(r, key, &value) ||
299 color_parse(value, dst))
300 strlcpy(dst, default_color, COLOR_MAXLEN);
301
302 free(key);
303}
304
305static enum git_colorbool check_color_config(struct repository *r, const char *var)
306{

Callers 1

interactive_config_initFunction · 0.85

Calls 3

xstrfmtFunction · 0.85
repo_config_get_valueFunction · 0.85
color_parseFunction · 0.85

Tested by

no test coverage detected