Skip to content

Commit

Permalink
fmt-patch: output file names to stdout
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed May 5, 2006
1 parent 0377db7 commit 81f3a18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ static int istitlechar(char c)
(c >= '0' && c <= '9') || c == '.' || c == '_';
}

static FILE *realstdout = NULL;

static void reopen_stdout(struct commit *commit, int nr)
{
char filename[1024];
Expand Down Expand Up @@ -117,7 +119,7 @@ static void reopen_stdout(struct commit *commit, int nr)
len--;
}
strcpy(filename + len, ".txt");
fprintf(stderr, "%s\n", filename);
fprintf(realstdout, "%s\n", filename);
freopen(filename, "w", stdout);
}

Expand Down Expand Up @@ -149,6 +151,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
argv++;
}

if (!use_stdout)
realstdout = fdopen(dup(1), "w");

prepare_revision_walk(&rev);
while ((commit = get_revision(&rev)) != NULL) {
/* ignore merges */
Expand Down

0 comments on commit 81f3a18

Please sign in to comment.