[PATCH] format-patch: assume --cover-letter for diff in multi-patch series

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If either `--interdiff` or `--range-diff` is specified without
`--cover-letter`, we'll abort if it would result in a multi-patch series
being generated.  Because the cover-letter is needed to give the diff
text in a multi-patch series.

Considering that `format-patch` generates a multi-patch as needed, let's
adopt a similar "cover as necessary" approach when using `--interdiff`
or `--range-diff`.

Signed-off-by: Rubén Justo <rjusto@xxxxxxxxx>
---
 builtin/log.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index c8ce0c0d88..56101672f8 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -2286,8 +2286,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		rev.total = total + start_number - 1;
 
 	if (idiff_prev.nr) {
-		if (!cover_letter && total != 1)
-			die(_("--interdiff requires --cover-letter or single patch"));
+		if (!cover_letter && total != 1) {
+			warning(_("--interdiff implies --cover-letter for multi-patch series"));
+			cover_letter = 1;
+		}
 		rev.idiff_oid1 = &idiff_prev.oid[idiff_prev.nr - 1];
 		rev.idiff_oid2 = get_commit_tree_oid(list[0]);
 		rev.idiff_title = diff_title(&idiff_title, reroll_count,
@@ -2301,8 +2303,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		die(_("the option '%s' requires '%s'"), "--creation-factor", "--range-diff");
 
 	if (rdiff_prev) {
-		if (!cover_letter && total != 1)
-			die(_("--range-diff requires --cover-letter or single patch"));
+		if (!cover_letter && total != 1) {
+			warning(_("--range-diff implies --cover-letter for multi-patch series"));
+			cover_letter = 1;
+		}
 
 		infer_range_diff_ranges(&rdiff1, &rdiff2, rdiff_prev,
 					origin, list[0]);
-- 
2.45.2.405.gf8e6085128




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux