| 416 | } |
| 417 | |
| 418 | bool 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 | |
| 443 | int git_color_config(const char *var, const char *value, void *cb UNUSED) |
| 444 | { |
no test coverage detected