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

Function want_color_fd

color.c:418–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418bool want_color_fd(int fd, enum git_colorbool var)
419{
420 /*
421 * NEEDSWORK: This function is sometimes used from multiple threads, and
422 * we end up using want_auto racily. That "should not matter" since
423 * we always write the same value, but it's still wrong. This function
424 * is listed in .tsan-suppressions for the time being.
425 */
426
427 static int want_auto[3] = { -1, -1, -1 };
428
429 if (fd < 1 || fd >= ARRAY_SIZE(want_auto))
430 BUG("file descriptor out of range: %d", fd);
431
432 if (var == GIT_COLOR_UNKNOWN)
433 var = git_use_color_default;
434
435 if (var == GIT_COLOR_AUTO) {
436 if (want_auto[fd] < 0)
437 want_auto[fd] = check_auto_color(fd);
438 return want_auto[fd];
439 }
440 return var == GIT_COLOR_ALWAYS;
441}
442
443int git_color_config(const char *var, const char *value, void *cb UNUSED)
444{

Callers 1

parse_diffFunction · 0.85

Calls 1

check_auto_colorFunction · 0.85

Tested by

no test coverage detected