Skip to content

Commit 06c0f42

Browse files
committed
Merge branch 'cn/format-patch-quiet' into maint
* cn/format-patch-quiet: format-patch: document --quiet option format-patch: don't pass on the --quiet flag
2 parents ab02095 + b781cfa commit 06c0f42

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Documentation/git-format-patch.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SYNOPSIS
2020
[--ignore-if-in-upstream]
2121
[--subject-prefix=Subject-Prefix]
2222
[--to=<email>] [--cc=<email>]
23-
[--cover-letter]
23+
[--cover-letter] [--quiet]
2424
[<common diff options>]
2525
[ <since> | <revision range> ]
2626

@@ -196,6 +196,9 @@ will want to ensure that threading is disabled for `git send-email`.
196196
Note that the leading character does not have to be a dot; for example,
197197
you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
198198

199+
--quiet::
200+
Do not print the names of the generated files to standard output.
201+
199202
--no-binary::
200203
Do not output contents of changes in binary files, instead
201204
display a notice that those files changed. Patches generated

builtin/log.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static FILE *realstdout = NULL;
627627
static const char *output_directory = NULL;
628628
static int outdir_offset;
629629

630-
static int reopen_stdout(struct commit *commit, struct rev_info *rev)
630+
static int reopen_stdout(struct commit *commit, struct rev_info *rev, int quiet)
631631
{
632632
struct strbuf filename = STRBUF_INIT;
633633
int suffix_len = strlen(fmt_patch_suffix) + 1;
@@ -643,7 +643,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
643643

644644
get_patch_filename(commit, rev->nr, fmt_patch_suffix, &filename);
645645

646-
if (!DIFF_OPT_TST(&rev->diffopt, QUICK))
646+
if (!quiet)
647647
fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
648648

649649
if (freopen(filename.buf, "w", stdout) == NULL)
@@ -722,7 +722,8 @@ static void print_signature(void)
722722
static void make_cover_letter(struct rev_info *rev, int use_stdout,
723723
int numbered, int numbered_files,
724724
struct commit *origin,
725-
int nr, struct commit **list, struct commit *head)
725+
int nr, struct commit **list, struct commit *head,
726+
int quiet)
726727
{
727728
const char *committer;
728729
const char *subject_start = NULL;
@@ -758,7 +759,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
758759
sha1_to_hex(head->object.sha1), committer, committer);
759760
}
760761

761-
if (!use_stdout && reopen_stdout(commit, rev))
762+
if (!use_stdout && reopen_stdout(commit, rev, quiet))
762763
return;
763764

764765
if (commit) {
@@ -999,6 +1000,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
9991000
char *add_signoff = NULL;
10001001
struct strbuf buf = STRBUF_INIT;
10011002
int use_patch_format = 0;
1003+
int quiet = 0;
10021004
const struct option builtin_format_patch_options[] = {
10031005
{ OPTION_CALLBACK, 'n', "numbered", &numbered, NULL,
10041006
"use [PATCH n/m] even with a single patch",
@@ -1054,6 +1056,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
10541056
PARSE_OPT_OPTARG, thread_callback },
10551057
OPT_STRING(0, "signature", &signature, "signature",
10561058
"add a signature"),
1059+
OPT_BOOLEAN(0, "quiet", &quiet,
1060+
"don't print the patch filenames"),
10571061
OPT_END()
10581062
};
10591063

@@ -1263,7 +1267,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
12631267
if (thread)
12641268
gen_message_id(&rev, "cover");
12651269
make_cover_letter(&rev, use_stdout, numbered, numbered_files,
1266-
origin, nr, list, head);
1270+
origin, nr, list, head, quiet);
12671271
total++;
12681272
start_number--;
12691273
}
@@ -1309,7 +1313,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
13091313
}
13101314

13111315
if (!use_stdout && reopen_stdout(numbered_files ? NULL : commit,
1312-
&rev))
1316+
&rev, quiet))
13131317
die(_("Failed to create output files"));
13141318
shown = log_tree_commit(&rev, commit);
13151319
free(commit->buffer);

0 commit comments

Comments
 (0)