format-patch: Respect --quiet option
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>
Nate Case committed
Mar 18, 2009 at 12:00 UTC
ec2956df592338ccd789428e9232fe6b709dc2be
1 file changed
+6
-4
builtin-log.c
+6
-4
@@ -573,7 +573,7 @@ static FILE *realstdout = NULL;
573
static const char *output_directory = NULL;
574
static int outdir_offset;
575
576
-static int reopen_stdout(const char *oneline, int nr, int total)
576
+static int reopen_stdout(const char *oneline, int nr, struct rev_info *rev)
577
{
578
char filename[PATH_MAX];
579
int len = 0;
@@ -598,7 +598,9 @@ static int reopen_stdout(const char *oneline, int nr, int total)
598
strcpy(filename + len, fmt_patch_suffix);
599
}
600
601
- fprintf(realstdout, "%s\n", filename + outdir_offset);
601
+ if (!DIFF_OPT_TST(&rev->diffopt, QUIET))
602
+ fprintf(realstdout, "%s\n", filename + outdir_offset);
603
+
604
if (freopen(filename, "w", stdout) == NULL)
605
return error("Cannot open patch file %s",filename);
606
@@ -687,7 +689,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
689
die("Cover letter needs email format");
690
691
if (!use_stdout && reopen_stdout(numbered_files ?
690
- NULL : "cover-letter", 0, rev->total))
692
+ NULL : "cover-letter", 0, rev))
693
return;
694
695
head_sha1 = sha1_to_hex(head->object.sha1);
@@ -1106,7 +1108,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1108
}
1109
if (!use_stdout && reopen_stdout(numbered_files ? NULL :
1110
get_oneline_for_filename(commit, keep_subject),
1109
- rev.nr, rev.total))
1111
+ rev.nr, &rev))
1112
die("Failed to create output files");
1113
shown = log_tree_commit(&rev, commit);
1114
free(commit->buffer);