diff: do not color output when --color=auto and --output=<file> is given
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index fa78fc189cd7225767817a2d24ef6c3b19bef9d8..b66b9beabcf5372463de0c5b2349caef868a8725 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3977,6 +3977,8 @@ int diff_opt_parse(struct diff_options *options,
                if (!options->file)
                        die_errno("Could not open '%s'", path);
                options->close_file = 1;
+               if (options->use_color != GIT_COLOR_ALWAYS)
+                       options->use_color = GIT_COLOR_NEVER;
                return argcount;
        } else
                return 0;