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
This commit is contained in:
commit
06c0f42f94
@ -20,7 +20,7 @@ SYNOPSIS
|
|||||||
[--ignore-if-in-upstream]
|
[--ignore-if-in-upstream]
|
||||||
[--subject-prefix=Subject-Prefix]
|
[--subject-prefix=Subject-Prefix]
|
||||||
[--to=<email>] [--cc=<email>]
|
[--to=<email>] [--cc=<email>]
|
||||||
[--cover-letter]
|
[--cover-letter] [--quiet]
|
||||||
[<common diff options>]
|
[<common diff options>]
|
||||||
[ <since> | <revision range> ]
|
[ <since> | <revision range> ]
|
||||||
|
|
||||||
@ -196,6 +196,9 @@ will want to ensure that threading is disabled for `git send-email`.
|
|||||||
Note that the leading character does not have to be a dot; for example,
|
Note that the leading character does not have to be a dot; for example,
|
||||||
you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
|
you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
|
||||||
|
|
||||||
|
--quiet::
|
||||||
|
Do not print the names of the generated files to standard output.
|
||||||
|
|
||||||
--no-binary::
|
--no-binary::
|
||||||
Do not output contents of changes in binary files, instead
|
Do not output contents of changes in binary files, instead
|
||||||
display a notice that those files changed. Patches generated
|
display a notice that those files changed. Patches generated
|
||||||
|
@ -627,7 +627,7 @@ static FILE *realstdout = NULL;
|
|||||||
static const char *output_directory = NULL;
|
static const char *output_directory = NULL;
|
||||||
static int outdir_offset;
|
static int outdir_offset;
|
||||||
|
|
||||||
static int reopen_stdout(struct commit *commit, struct rev_info *rev)
|
static int reopen_stdout(struct commit *commit, struct rev_info *rev, int quiet)
|
||||||
{
|
{
|
||||||
struct strbuf filename = STRBUF_INIT;
|
struct strbuf filename = STRBUF_INIT;
|
||||||
int suffix_len = strlen(fmt_patch_suffix) + 1;
|
int suffix_len = strlen(fmt_patch_suffix) + 1;
|
||||||
@ -643,7 +643,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
|
|||||||
|
|
||||||
get_patch_filename(commit, rev->nr, fmt_patch_suffix, &filename);
|
get_patch_filename(commit, rev->nr, fmt_patch_suffix, &filename);
|
||||||
|
|
||||||
if (!DIFF_OPT_TST(&rev->diffopt, QUICK))
|
if (!quiet)
|
||||||
fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
|
fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
|
||||||
|
|
||||||
if (freopen(filename.buf, "w", stdout) == NULL)
|
if (freopen(filename.buf, "w", stdout) == NULL)
|
||||||
@ -722,7 +722,8 @@ static void print_signature(void)
|
|||||||
static void make_cover_letter(struct rev_info *rev, int use_stdout,
|
static void make_cover_letter(struct rev_info *rev, int use_stdout,
|
||||||
int numbered, int numbered_files,
|
int numbered, int numbered_files,
|
||||||
struct commit *origin,
|
struct commit *origin,
|
||||||
int nr, struct commit **list, struct commit *head)
|
int nr, struct commit **list, struct commit *head,
|
||||||
|
int quiet)
|
||||||
{
|
{
|
||||||
const char *committer;
|
const char *committer;
|
||||||
const char *subject_start = NULL;
|
const char *subject_start = NULL;
|
||||||
@ -758,7 +759,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
|
|||||||
sha1_to_hex(head->object.sha1), committer, committer);
|
sha1_to_hex(head->object.sha1), committer, committer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!use_stdout && reopen_stdout(commit, rev))
|
if (!use_stdout && reopen_stdout(commit, rev, quiet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (commit) {
|
if (commit) {
|
||||||
@ -999,6 +1000,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
|||||||
char *add_signoff = NULL;
|
char *add_signoff = NULL;
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
int use_patch_format = 0;
|
int use_patch_format = 0;
|
||||||
|
int quiet = 0;
|
||||||
const struct option builtin_format_patch_options[] = {
|
const struct option builtin_format_patch_options[] = {
|
||||||
{ OPTION_CALLBACK, 'n', "numbered", &numbered, NULL,
|
{ OPTION_CALLBACK, 'n', "numbered", &numbered, NULL,
|
||||||
"use [PATCH n/m] even with a single patch",
|
"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)
|
|||||||
PARSE_OPT_OPTARG, thread_callback },
|
PARSE_OPT_OPTARG, thread_callback },
|
||||||
OPT_STRING(0, "signature", &signature, "signature",
|
OPT_STRING(0, "signature", &signature, "signature",
|
||||||
"add a signature"),
|
"add a signature"),
|
||||||
|
OPT_BOOLEAN(0, "quiet", &quiet,
|
||||||
|
"don't print the patch filenames"),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1263,7 +1267,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
|||||||
if (thread)
|
if (thread)
|
||||||
gen_message_id(&rev, "cover");
|
gen_message_id(&rev, "cover");
|
||||||
make_cover_letter(&rev, use_stdout, numbered, numbered_files,
|
make_cover_letter(&rev, use_stdout, numbered, numbered_files,
|
||||||
origin, nr, list, head);
|
origin, nr, list, head, quiet);
|
||||||
total++;
|
total++;
|
||||||
start_number--;
|
start_number--;
|
||||||
}
|
}
|
||||||
@ -1309,7 +1313,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!use_stdout && reopen_stdout(numbered_files ? NULL : commit,
|
if (!use_stdout && reopen_stdout(numbered_files ? NULL : commit,
|
||||||
&rev))
|
&rev, quiet))
|
||||||
die(_("Failed to create output files"));
|
die(_("Failed to create output files"));
|
||||||
shown = log_tree_commit(&rev, commit);
|
shown = log_tree_commit(&rev, commit);
|
||||||
free(commit->buffer);
|
free(commit->buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user