Warn when we read such a configuration from a file, and nudge the
users to spell them 'auto' instead.

Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 Documentation/config.txt | 2 +-
 color.c                  | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index cb0f951ddc..ba01b8d3df 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1178,7 +1178,7 @@ color.ui::
        or the `--color` option. Set it to `true` or `auto` to enable
        color when output is written to the terminal (this is also the
        default since Git 1.8.4). The value `always` is a historical
-       synonym for `auto`.
+       synonym for `auto` and its use is discouraged.
 
 column.ui::
        Specify whether supported commands should output in columns.
diff --git a/color.c b/color.c
index 5b06c76bdc..5119f9bca0 100644
--- a/color.c
+++ b/color.c
@@ -308,6 +308,8 @@ int git_config_colorbool(const char *var, const char *value)
                if (!strcasecmp(value, "never"))
                        return 0;
                if (!strcasecmp(value, "always")) {
+                       static int warn_once;
+
                        /*
                         * Command-line options always respect "always".
                         * Likewise for "-c" config on the command-line.
@@ -320,6 +322,11 @@ int git_config_colorbool(const char *var, const char 
*value)
                         * Otherwise, we're looking at on-disk config;
                         * downgrade to auto.
                         */
+                       if (!warn_once) {
+                               warn_once++;
+                               warning("setting '%s' to '%s' is no longer 
valid; "
+                                       "set it to 'auto' instead", var, value);
+                       }
                        return GIT_COLOR_AUTO;
                }
                if (!strcasecmp(value, "auto"))
-- 
2.15.0-rc1-151-g44fe2f342f

Reply via email to