summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2016-06-20 12:55:49 +0200
committerJunio C Hamano <gitster@pobox.com>2016-06-20 12:50:39 -0700
commitc17fd15f91d6b9951ea269eca58d67361443e53e (patch)
tree2a6f5902795e2b7173a3b426270917f7cc637ef7
parente1c21e00188b9b706eb589049a377998cde53622 (diff)
downloadgit-c17fd15f91d6b9951ea269eca58d67361443e53e.tar.gz
format-patch: explicitly switch off color when writing to files
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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/log.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 099f4f7be9..abd889bcd0 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)