OSDN Git Service

format-patch: avoid freopen()
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 22 Jun 2016 15:01:59 +0000 (17:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jun 2016 22:20:47 +0000 (15:20 -0700)
commit95235f5ba1a9398c8503b809370ece18bba72ba2
treeaf1681d17e9ecf2a099ffdd902ea79fb937064cd
parent11f4eb19843c28b1c50d3c1bef1183e6313b87b8
format-patch: avoid freopen()

We just taught the relevant functions to respect the diffopt.file field,
to allow writing somewhere else than stdout. Let's make use of it.

Technically, we do not need to avoid that call in a builtin: we assume
that builtins (as opposed to library functions) are stand-alone programs
that may do with their (global) state. Yet, we want to be able to reuse
that code in properly lib-ified code, e.g. when converting scripts into
builtins.

Further, while we did not *have* to touch the cmd_show() and cmd_cherry()
code paths (because they do not want to write anywhere but stdout as of
yet), it just makes sense to be consistent, making it easier and safer to
move the code later.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/log.c