git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>
Subject: [RFC PATCH] format-patch: Add config option format.coverbodytext to change the cover letter body
Date: Mon,  5 Jan 2015 11:28:25 -0800	[thread overview]
Message-ID: <1420486105-30242-1-git-send-email-sbeller@google.com> (raw)

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

             reply	other threads:[~2015-01-05 19:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 19:28 Stefan Beller [this message]
2015-01-06 10:37 ` [RFC PATCH] format-patch: Add config option format.coverbodytext to change the cover letter body Junio C Hamano
2015-01-06 18:08   ` Stefan Beller
2015-01-06 18:57     ` Junio C Hamano
2015-01-06 19:14       ` Stefan Beller
2015-01-06 22:35         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420486105-30242-1-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).