Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 4c7f181

Browse files
moygitster
authored andcommitted
make color.ui default to 'auto'
Most users seem to like having colors enabled, and colors can help beginners to understand the output of some commands (e.g. notice immediately the boundary between commits in the output of "git log"). Many tutorials tell the users to set color.ui=auto as a very first step, which tend to indicate that color.ui=none is not the recommanded value, hence should not be the default. These tutorials would benefit from skipping this step and starting the real Git manipulations earlier. Other beginners do not know about color.ui=auto, and may not discover it by themselves, hence live with black&white outputs while they may have preferred colors. A few people (e.g. color-blind) prefer having no colors, but they can easily set color.ui=never for this (and googling "disable colors in git" already tells them how to do so), but this needs not occupy space in beginner-oriented documentations. A transition period with Git emitting a warning when color.ui is unset would be possible, but the discomfort of having the warning seems superior to the benefit: users may be surprised by the change, but not harmed by it. The default value is changed, and the documentation is reworded to mention "color.ui=false" first, since the primary use of color.ui after this change is to disable colors, not to enable it. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b8612b4 commit 4c7f181

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Documentation/config.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,11 +905,12 @@ color.ui::
905905
as `color.diff` and `color.grep` that control the use of color
906906
per command family. Its scope will expand as more commands learn
907907
configuration to set a default for the `--color` option. Set it
908-
to `always` if you want all output not intended for machine
909-
consumption to use color, to `true` or `auto` if you want such
910-
output to use color when written to the terminal, or to `false` or
911-
`never` if you prefer Git commands not to use color unless enabled
912-
explicitly with some other configuration or the `--color` option.
908+
to `false` or `never` if you prefer Git commands not to use
909+
color unless enabled explicitly with some other configuration
910+
or the `--color` option. Set it to `always` if you want all
911+
output not intended for machine consumption to use color, to
912+
`true` or `auto` (this is the default since Git 1.8.4) if you
913+
want such output to use color when written to the terminal.
913914

914915
column.ui::
915916
Specify whether supported commands should output in columns.

builtin/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static int get_colorbool(int print)
342342

343343
if (get_colorbool_found < 0)
344344
/* default value if none found in config */
345-
get_colorbool_found = 0;
345+
get_colorbool_found = GIT_COLOR_AUTO;
346346

347347
get_colorbool_found = want_color(get_colorbool_found);
348348

color.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "cache.h"
22
#include "color.h"
33

4-
static int git_use_color_default = 0;
4+
static int git_use_color_default = GIT_COLOR_AUTO;
55
int color_stdout_is_tty = -1;
66

77
/*

0 commit comments

Comments
 (0)