[RFC PATCH] format-patch: Add config option format.coverbodytext to change the cover letter body

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

 



When sending out patch series one of the last things doing is writing
the cover letter. The cover letter would be a good place to remind
people to check the todo list for sending patches. As people have
different levels of confidence and sloppiness this todo list may be
lengthier for some people compared to others. To make this possible
this adds a way to put your personal todo list for sending patches in
the cover letter, so you'll see it every time you intend to send patches.

This intentionally doesn't let you configure the subject line of the cover letter
as send email will stop you if you want to send out the coverletter with untouched
subject line (*** SUBJECT HERE***).

Not-signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> as it's RFC.

---
 builtin/log.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 734aab3..84da54d 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -34,6 +34,7 @@ static int default_show_root = 1;
 static int decoration_style;
 static int decoration_given;
 static int use_mailmap_config;
+static const char *fmt_patch_body_text = "*** BLURB HERE ***";
 static const char *fmt_patch_subject_prefix = "PATCH";
 static const char *fmt_pretty;
 
@@ -374,6 +375,8 @@ static int git_log_config(const char *var, const char *value, void *cb)
 		return git_config_string(&fmt_pretty, var, value);
 	if (!strcmp(var, "format.subjectprefix"))
 		return git_config_string(&fmt_patch_subject_prefix, var, value);
+	if (!strcmp(var, "format.coverbodytext"))
+		return git_config_string(&fmt_patch_body_text, var, value);
 	if (!strcmp(var, "log.abbrevcommit")) {
 		default_abbrev_commit = git_config_bool(var, value);
 		return 0;
@@ -904,8 +907,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
 			      int quiet)
 {
 	const char *committer;
-	const char *body = "*** SUBJECT HERE ***\n\n*** BLURB HERE ***\n";
-	const char *msg;
+	const char *subject = "*** SUBJECT HERE ***\n\n";
+	struct strbuf msg = STRBUF_INIT;
 	struct shortlog log;
 	struct strbuf sb = STRBUF_INIT;
 	int i;
@@ -937,16 +940,18 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
 	if (!branch_name)
 		branch_name = find_branch_name(rev);
 
-	msg = body;
+	strbuf_addstr(&msg, subject);
+	strbuf_addstr(&msg, fmt_patch_body_text);
 	pp.fmt = CMIT_FMT_EMAIL;
 	pp.date_mode = DATE_RFC2822;
 	pp_user_info(&pp, NULL, &sb, committer, encoding);
-	pp_title_line(&pp, &msg, &sb, encoding, need_8bit_cte);
-	pp_remainder(&pp, &msg, &sb, 0);
+	pp_title_line(&pp, &msg.buf, &sb, encoding, need_8bit_cte);
+	pp_remainder(&pp, &msg.buf, &sb, 0);
 	add_branch_description(&sb, branch_name);
 	printf("%s\n", sb.buf);
 
 	strbuf_release(&sb);
+	strbuf_release(&msg);
 
 	shortlog_init(&log);
 	log.wrap_lines = 1;
-- 
2.2.1.62.g3f15098

--
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



[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]