add_ref(): verify that the refname is formatted correctly
[gitweb.git] / color.c
diff --git a/color.c b/color.c
index ec96fe1045390b2c10fc989ea17d9c6e7ecea781..e8e26818b3b1f2ffce1374e2edf88b40c575c3dd 100644 (file)
--- a/color.c
+++ b/color.c
@@ -1,7 +1,7 @@
 #include "cache.h"
 #include "color.h"
 
-int git_use_color_default = 0;
+static int git_use_color_default = 0;
 int color_stdout_is_tty = -1;
 
 /*
@@ -196,12 +196,15 @@ int want_color(int var)
 {
        static int want_auto = -1;
 
+       if (var < 0)
+               var = git_use_color_default;
+
        if (var == GIT_COLOR_AUTO) {
                if (want_auto < 0)
                        want_auto = check_auto_color();
                return want_auto;
        }
-       return var > 0;
+       return var;
 }
 
 int git_color_config(const char *var, const char *value, void *cb)