Skip to content

Commit 36a4d90

Browse files
dschogitster
authored andcommitted
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>
1 parent 95235f5 commit 36a4d90

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

builtin/log.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,6 @@ static int git_format_config(const char *var, const char *value, void *cb)
805805
return git_log_config(var, value, cb);
806806
}
807807

808-
static FILE *realstdout = NULL;
809808
static const char *output_directory = NULL;
810809
static int outdir_offset;
811810

@@ -831,7 +830,7 @@ static int open_next_file(struct commit *commit, const char *subject,
831830
fmt_output_subject(&filename, subject, rev);
832831

833832
if (!quiet)
834-
fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
833+
printf("%s\n", filename.buf + outdir_offset);
835834

836835
if ((rev->diffopt.file = fopen(filename.buf, "w")) == NULL)
837836
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)
16391638
get_patch_ids(&rev, &ids);
16401639
}
16411640

1642-
if (!use_stdout)
1643-
realstdout = xfdopen(xdup(1), "w");
1644-
16451641
if (prepare_revision_walk(&rev))
16461642
die(_("revision walk setup failed"));
16471643
rev.boundary = 1;

0 commit comments

Comments
 (0)