git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] format-patch: assume --cover-letter for diff in multi-patch series
@ 2024-06-03 22:49 Rubén Justo
  2024-06-04  8:02 ` Patrick Steinhardt
  2024-06-05 18:01 ` Rubén Justo
  0 siblings, 2 replies; 21+ messages in thread
From: Rubén Justo @ 2024-06-03 22:49 UTC (permalink / raw)
  To: Git List

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@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-06-07 21:10 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-03 22:49 [PATCH] format-patch: assume --cover-letter for diff in multi-patch series Rubén Justo
2024-06-04  8:02 ` Patrick Steinhardt
2024-06-04 17:32   ` Junio C Hamano
2024-06-05 18:01 ` Rubén Justo
2024-06-05 18:17   ` Junio C Hamano
2024-06-05 18:58     ` Junio C Hamano
2024-06-05 20:27   ` [PATCH v3] " Rubén Justo
2024-06-05 20:44     ` Junio C Hamano
2024-06-05 21:24       ` Rubén Justo
2024-06-05 21:52         ` Junio C Hamano
2024-06-05 21:39       ` Rubén Justo
2024-06-07 16:29     ` [PATCH v4 0/2] " Rubén Justo
2024-06-07 16:30       ` [PATCH v4 1/2] t4014: cleanups in a few tests Rubén Justo
2024-06-07 17:14         ` Junio C Hamano
2024-06-07 17:38           ` Rubén Justo
2024-06-07 18:57             ` Junio C Hamano
2024-06-07 16:30       ` [PATCH v4 2/2] format-patch: assume --cover-letter for diff in multi-patch series Rubén Justo
2024-06-07 20:52       ` [PATCH v5 0/2] " Rubén Justo
2024-06-07 20:55         ` [PATCH v5 1/2] t4014: cleanups in a few tests Rubén Justo
2024-06-07 20:55         ` [PATCH v5 2/2] format-patch: assume --cover-letter for diff in multi-patch series Rubén Justo
2024-06-07 21:10         ` [PATCH v5 0/2] " Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).