{"thread":{"id":"34088","subject":"[PATCH 1/2] config: refactor management of color.ui's default value","startedAt":"2013-06-10T14:26:08Z","lastAt":"2013-06-10T20:50:19Z","messageCount":3,"participants":["Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"220286","messageId":"1370874369-30248-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"34088","inReplyTo":null,"subject":"[PATCH 1/2] config: refactor management of color.ui's default value","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-06-10T14:26:08Z","receivedAt":"2013-06-10T14:26:08Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"The meaning of get_colorbool_found and get_diff_color_found is \"the\nconfig value if found, and -1 otherwise\", but get_color_ui_found had a\nslightly different meaning, as it has the value 0 (which corresponds to\nthe default value from the user point of view) when color.ui is unset.\n\nMake get_color_ui_found default to -1, and make it explicit that 0 is the\ndefault value when nothing else is found.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\nThis one is just a resend of what's already in pu.\n\n builtin/config.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 33c9bf9..057bb61 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -329,6 +329,7 @@ static int get_colorbool(int print)\n {\n \tget_colorbool_found = -1;\n \tget_diff_color_found = -1;\n+\tget_color_ui_found = -1;\n \tgit_config_with_options(git_get_colorbool_config, NULL,\n \t\t\t\tgiven_config_file, respect_includes);\n \n@@ -339,6 +340,10 @@ static int get_colorbool(int print)\n \t\t\tget_colorbool_found = get_color_ui_found;\n \t}\n \n+\tif (get_colorbool_found < 0)\n+\t\t/* default value if none found in config */\n+\t\tget_colorbool_found = 0;\n+\n \tget_colorbool_found = want_color(get_colorbool_found);\n \n \tif (print) {\n-- \n1.8.3.rc3.8.g5e49f30\n"},{"id":"220287","messageId":"1370874369-30248-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"34088","inReplyTo":"1370874369-30248-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/2] make color.ui default to 'auto'","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-06-10T14:26:09Z","receivedAt":"2013-06-10T14:26:09Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Most users seem to like having colors enabled, and colors can help\nbeginners to understand the output of some commands (e.g. notice\nimmediately the boundary between commits in the output of \"git log\").\n\nMany tutorials tell the users to set color.ui=auto as a very first step,\nwhich tend to indicate that color.ui=none is not the recommanded value,\nhence should not be the default.\n\nThese tutorials would benefit from skipping this step and starting the\nreal Git manipulations earlier. Other beginners do not know about\ncolor.ui=auto, and may not discover it by themselves, hence live with\nblack&white outputs while they may have preferred colors.\n\nA few people (e.g. color-blind) prefer having no colors, but they can\neasily set color.ui=never for this (and googling \"disable colors in git\"\nalready tells them how to do so), but this needs not occupy space in\nbeginner-oriented documentations.\n\nA transition period with Git emitting a warning when color.ui is unset\nwould be possible, but the discomfort of having the warning seems\nsuperior to the benefit: users may be surprised by the change, but not\nharmed by it.\n\nThe default value is changed, and the documentation is reworded to\nmention \"color.ui=false\" first, since the primary use of color.ui after\nthis change is to disable colors, not to enable it.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\nI just changed \"Git 2.0\" with \"Git 1.8.4\". I think a default change\ndeserves a mention of the version in which it changed (I think it's\ncommon for someone to use an old Git version and to read a more recent\ndocumentation online, so this may avoid bad surprises). I'm fine with\ndropping \"since Git 1.8.4\" completely if people think it's better.\n\n Documentation/config.txt | 11 ++++++-----\n builtin/config.c         |  2 +-\n color.c                  |  2 +-\n 3 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e97facc..6570aee 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -905,11 +905,12 @@ color.ui::\n \tas `color.diff` and `color.grep` that control the use of color\n \tper command family. Its scope will expand as more commands learn\n \tconfiguration to set a default for the `--color` option.  Set it\n-\tto `always` if you want all output not intended for machine\n-\tconsumption to use color, to `true` or `auto` if you want such\n-\toutput to use color when written to the terminal, or to `false` or\n-\t`never` if you prefer Git commands not to use color unless enabled\n-\texplicitly with some other configuration or the `--color` option.\n+\tto `false` or `never` if you prefer Git commands not to use\n+\tcolor unless enabled explicitly with some other configuration\n+\tor the `--color` option. Set it to `always` if you want all\n+\toutput not intended for machine consumption to use color, to\n+\t`true` or `auto` (this is the default since Git 1.8.4) if you\n+\twant such output to use color when written to the terminal.\n \n column.ui::\n \tSpecify whether supported commands should output in columns.\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 057bb61..753449f 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -342,7 +342,7 @@ static int get_colorbool(int print)\n \n \tif (get_colorbool_found < 0)\n \t\t/* default value if none found in config */\n-\t\tget_colorbool_found = 0;\n+\t\tget_colorbool_found = GIT_COLOR_AUTO;\n \n \tget_colorbool_found = want_color(get_colorbool_found);\n \ndiff --git a/color.c b/color.c\nindex e8e2681..f672885 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,7 +1,7 @@\n #include \"cache.h\"\n #include \"color.h\"\n \n-static int git_use_color_default = 0;\n+static int git_use_color_default = GIT_COLOR_AUTO;\n int color_stdout_is_tty = -1;\n \n /*\n-- \n1.8.3.rc3.8.g5e49f30\n"},{"id":"220375","messageId":"7vd2rtg06s.fsf@alter.siamese.dyndns.org","threadId":"34088","inReplyTo":"1370874369-30248-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 1/2] config: refactor management of color.ui's default value","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-10T20:50:19Z","receivedAt":"2013-06-10T20:50:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}