When using --cover-letter, a cover letter is created even if the patch series is only one patch long. By setting format.coveronepatch to 'false', this is prevented. To temporarily force creating cover letter even for one-patch "series", the --cover-one-patch option may be used. To always create cover letters, the format.coverletter option may be set to 'true'. A possible setup to create cover letters for every created patch series, that is longer than one patch, would be: [format] coverletter = true coveronepatch = false git-format-patch's default behaviour is not altered by this patch. Signed-off-by: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> --- builtin-log.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 5eaec5d..82d8724 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -436,6 +436,9 @@ static char **extra_cc; static int extra_cc_nr; static int extra_cc_alloc; +static int cover_letter = 0; +static int cover_one_patch = 1; + static void add_header(const char *value) { int len = strlen(value); @@ -512,6 +515,14 @@ static int git_format_config(const char *var, const char *value, void *cb) do_signoff = git_config_bool(var, value); return 0; } + if (!strcmp(var, "format.coverletter")) { + cover_letter = git_config_bool(var, value); + return 0; + } + if (!strcmp(var, "format.coveronepatch")) { + cover_one_patch = git_config_bool(var, value); + return 0; + } return git_log_config(var, value, cb); } @@ -752,7 +763,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) int numbered_files = 0; /* _just_ numbers */ int subject_prefix = 0; int ignore_if_in_upstream = 0; - int cover_letter = 0; int boundary_count = 0; int no_binary_diff = 0; struct commit *origin = NULL, *head = NULL; @@ -868,6 +878,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) fmt_patch_suffix = argv[i] + 9; else if (!strcmp(argv[i], "--cover-letter")) cover_letter = 1; + else if (!strcmp(argv[i], "--cover-one-patch")) + cover_one_patch = 1; else if (!strcmp(argv[i], "--no-binary")) no_binary_diff = 1; else if (!prefixcmp(argv[i], "--add-header=")) @@ -1010,6 +1022,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) list[nr - 1] = commit; } total = nr; + if (!cover_one_patch && total == 1) + cover_letter = 0; if (!keep_subject && auto_number && total > 1) numbered = 1; if (numbered) -- 1.6.2.2.446.gfbdc0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html