From: Johannes Schindelin Date: Mon, 20 Jun 2016 10:55:49 GMT Subject: [PATCH v2 5/7] format-patch: explicitly switch off color when writing to files Message-ID: <2abbf428b42795f930c2338233b71f0f299e1d41.1466420060.git.johannes.schindelin@gmx.de> In-Reply-To: We rely on the auto-detection ("is stdout a terminal?") to determine whether to use color in the output of format-patch or not. That happens to work because we freopen() stdout when redirecting the output to files. However, we are about to fix that work-around, in which case the auto-detection has no chance to guess whether to use color or not. But then, we do not need to guess to begin with. We know that we do not want to use ANSI color sequences in the output files. So let's just be explicit about our wishes. Signed-off-by: Johannes Schindelin --- builtin/log.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/log.c b/builtin/log.c index 099f4f7..abd889b 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1569,6 +1569,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) setup_pager(); if (output_directory) { + rev.diffopt.use_color = 0; if (use_stdout) die(_("standard output, or directory, which one?")); if (mkdir(output_directory, 0777) < 0 && errno != EEXIST) -- 2.9.0.119.g370c5a9