format-patch: use stdout directly

Earlier, we freopen()ed stdout in order to write patches to files. That forced us to duplicate stdout (naming it "realstdout") because we *still* wanted to be able to report the file names. As we do not abuse stdout that way anymore, we no longer need to duplicate stdout, either. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jun 22, 2016 at 17:02 UTC 36a4d905c36a598d17274765b57690ecfb4a23f8
1 file changed +1 -5
builtin/log.c
+1 -5
@@ -805,7 +805,6 @@ static int git_format_config(const char *var, const char *value, void *cb)
805 return git_log_config(var, value, cb);
806 }
807
808 -static FILE *realstdout = NULL;
808 static const char *output_directory = NULL;
809 static int outdir_offset;
810
@@ -831,7 +830,7 @@ static int open_next_file(struct commit *commit, const char *subject,
830 fmt_output_subject(&filename, subject, rev);
831
832 if (!quiet)
834 - fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
833 + printf("%s\n", filename.buf + outdir_offset);
834
835 if ((rev->diffopt.file = fopen(filename.buf, "w")) == NULL)
836 return error(_("Cannot open patch file %s"), filename.buf);
@@ -1639,9 +1638,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1638 get_patch_ids(&rev, &ids);
1639 }
1640
1642 - if (!use_stdout)
1643 - realstdout = xfdopen(xdup(1), "w");
1644 -
1641 if (prepare_revision_walk(&rev))
1642 die(_("revision walk setup failed"));
1643 rev.boundary = 1;