Log ref changes made by git-merge and git-pull.
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 493650cc0eccfcb91422f3e4ff7de766590ba22c..287a927ce3131fd3a5c9151e5ea1e560842767a1 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -44,12 +44,12 @@ enum color_diff {
 #define COLOR_WHITE   "\033[37m"
 
 static const char *diff_colors[] = {
-       [DIFF_RESET]    = COLOR_RESET,
-       [DIFF_PLAIN]    = COLOR_NORMAL,
-       [DIFF_METAINFO] = COLOR_BOLD,
-       [DIFF_FRAGINFO] = COLOR_CYAN,
-       [DIFF_FILE_OLD] = COLOR_RED,
-       [DIFF_FILE_NEW] = COLOR_GREEN,
+       COLOR_RESET,
+       COLOR_NORMAL,
+       COLOR_BOLD,
+       COLOR_CYAN,
+       COLOR_RED,
+       COLOR_GREEN
 };
 
 static int parse_diff_color_slot(const char *var, int ofs)
@@ -117,8 +117,14 @@ int git_diff_ui_config(const char *var, const char *value)
        if (!strcmp(var, "diff.color")) {
                if (!value)
                        diff_use_color_default = 1; /* bool */
-               else if (!strcasecmp(value, "auto"))
-                       diff_use_color_default = isatty(1);
+               else if (!strcasecmp(value, "auto")) {
+                       diff_use_color_default = 0;
+                       if (isatty(1) || pager_in_use) {
+                               char *term = getenv("TERM");
+                               if (term && strcmp(term, "dumb"))
+                                       diff_use_color_default = 1;
+                       }
+               }
                else if (!strcasecmp(value, "never"))
                        diff_use_color_default = 0;
                else if (!strcasecmp(value, "always"))