summaryrefslogtreecommitdiff
path: root/builtin/log.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2016-06-22 14:41:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-28 18:26:47 (GMT)
commitafc676f2c9e20a5b38d61c7803468d33e2ff45f2 (patch)
tree655c149c88d965b7094ed8b9c9caf89cbc4ce590 /builtin/log.c
parentc1496934cfd6603ac3fbf74cc3a16fcd584d5484 (diff)
downloadgit-afc676f2c9e20a5b38d61c7803468d33e2ff45f2.zip
git-afc676f2c9e20a5b38d61c7803468d33e2ff45f2.tar.gz
git-afc676f2c9e20a5b38d61c7803468d33e2ff45f2.tar.bz2
diff: do not color output when --color=auto and --output=<file> is given
"git diff --output=<file> --color=auto" used to show the ANSI color sequence in the resulting file when the standard output is connected to a terminal, because --color=auto check always checks the standard output, not the actual file that receives the output. We could correct this by using freopen(3) to redirect the standard output to the specified file, which is in like with how format-patch used to match the world order, but following the same reasoning as the earlier "format-patch: explicitly switch off color when writing to files", let's be more strict by bypassing the "auto" check when the --output=<file> option is in use. Strictly speaking, this is a backwards-incompatible change, but it is highly unlikely that any user would want to see ANSI color sequences in a file. The reason this was not caught earlier is most likely that either --output=<file> is not used, or only when stdout is redirected anyway. Users can still give --color=always if they want a colored diff in the resulting file. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
0 files changed, 0 insertions, 0 deletions