fmt-patch: output file names to stdout
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
0377db77da
commit
81f3a188a3
@ -75,6 +75,8 @@ static int istitlechar(char c)
|
|||||||
(c >= '0' && c <= '9') || c == '.' || c == '_';
|
(c >= '0' && c <= '9') || c == '.' || c == '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FILE *realstdout = NULL;
|
||||||
|
|
||||||
static void reopen_stdout(struct commit *commit, int nr)
|
static void reopen_stdout(struct commit *commit, int nr)
|
||||||
{
|
{
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
@ -117,7 +119,7 @@ static void reopen_stdout(struct commit *commit, int nr)
|
|||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
strcpy(filename + len, ".txt");
|
strcpy(filename + len, ".txt");
|
||||||
fprintf(stderr, "%s\n", filename);
|
fprintf(realstdout, "%s\n", filename);
|
||||||
freopen(filename, "w", stdout);
|
freopen(filename, "w", stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,6 +151,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!use_stdout)
|
||||||
|
realstdout = fdopen(dup(1), "w");
|
||||||
|
|
||||||
prepare_revision_walk(&rev);
|
prepare_revision_walk(&rev);
|
||||||
while ((commit = get_revision(&rev)) != NULL) {
|
while ((commit = get_revision(&rev)) != NULL) {
|
||||||
/* ignore merges */
|
/* ignore merges */
|
||||||
|
Loading…
Reference in New Issue
Block a user