want_color: automatically fallback to color.ui
All of the "do we want color" flags default to -1 to indicate that we don't have any color configured. This value is handled in one of two ways: 1. In porcelain, we check early on whether the value is still -1 after reading the config, and set it to the value of color.ui (which defaults to 0). 2. In plumbing, it stays untouched as -1, and want_color defaults it to off. This works fine, but means that every porcelain has to check and reassign its color flag. Now that want_color gives us a place to put this check in a single spot, we can do that, simplifying the calling code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
3e1dd17a89
commit
c9bfb95348
@ -685,9 +685,6 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
||||
|
||||
git_config(git_show_branch_config, NULL);
|
||||
|
||||
if (showbranch_use_color == -1)
|
||||
showbranch_use_color = git_use_color_default;
|
||||
|
||||
/* If nothing is specified, try the default first */
|
||||
if (ac == 1 && default_num) {
|
||||
ac = default_num;
|
||||
|
Reference in New Issue
Block a user