Skip to content

Commit

Permalink
format-patch: Respect --quiet option
Browse files Browse the repository at this point in the history
Hide the patch filename output from 'git format-patch' when --quiet
is used.  The man pages suggested that this should have already worked.

Signed-off-by: Nate Case <ncase@xes-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nate Case authored and Junio C Hamano committed Mar 19, 2009
1 parent e986ceb commit ec2956d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ static FILE *realstdout = NULL;
static const char *output_directory = NULL;
static int outdir_offset;

static int reopen_stdout(const char *oneline, int nr, int total)
static int reopen_stdout(const char *oneline, int nr, struct rev_info *rev)
{
char filename[PATH_MAX];
int len = 0;
Expand All @@ -598,7 +598,9 @@ static int reopen_stdout(const char *oneline, int nr, int total)
strcpy(filename + len, fmt_patch_suffix);
}

fprintf(realstdout, "%s\n", filename + outdir_offset);
if (!DIFF_OPT_TST(&rev->diffopt, QUIET))
fprintf(realstdout, "%s\n", filename + outdir_offset);

if (freopen(filename, "w", stdout) == NULL)
return error("Cannot open patch file %s",filename);

Expand Down Expand Up @@ -687,7 +689,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
die("Cover letter needs email format");

if (!use_stdout && reopen_stdout(numbered_files ?
NULL : "cover-letter", 0, rev->total))
NULL : "cover-letter", 0, rev))
return;

head_sha1 = sha1_to_hex(head->object.sha1);
Expand Down Expand Up @@ -1106,7 +1108,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
}
if (!use_stdout && reopen_stdout(numbered_files ? NULL :
get_oneline_for_filename(commit, keep_subject),
rev.nr, rev.total))
rev.nr, &rev))
die("Failed to create output files");
shown = log_tree_commit(&rev, commit);
free(commit->buffer);
Expand Down

0 comments on commit ec2956d

Please sign in to comment.