git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: drafnel@gmail.com
To: git@vger.kernel.org
Cc: Brandon Casey <drafnel@gmail.com>
Subject: [PATCH] git-send-email: add option to force a From: line within the message body
Date: Mon,  3 Mar 2008 00:00:43 -0600	[thread overview]
Message-ID: <8870673.1204524015315.JavaMail.teamon@b301.teamon.com> (raw)

From: Brandon Casey <drafnel@gmail.com>

Add a new command line option --add-author-from and a config option
sendemail.addauthorfrom which will ensure that a From: line is added
to the message body regardless of whether the sender email matches the
From: line parsed from the supplied patch (i.e. the patch author).

This provides a work-around for mail gateways which override the From:
line of submitted messages.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---

I don't know if anyone else has the same problem, but I sometimes use a
mail gateway which forces a certain From: line overriding what is
supplied in the email. So, for me, the solution this patch provides could
be achieved by just typing in some bogus string when git-send-email prompts
for the From address, but this patch is more convenient and more general.

-brandon


 Documentation/git-send-email.txt |    9 +++++++++
 git-send-email.perl              |   12 ++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 336d797..e3267de 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -157,6 +157,11 @@ user is prompted for a password while the input is masked for privacy.
 	if that is unspecified, default to 'self' if --suppress-from is
 	specified, as well as 'sob' if --no-signed-off-cc is specified.
 
+--add-author-from::
+	Add a "From:" line within the message body describing the patch
+	author even if the author is equal to the sender. Usually, a "From:"
+	line is added only when the author differs from the sender.
+
 --thread, --no-thread::
 	If this is set, the In-Reply-To header will be set on each email sent.
 	If disabled with "--no-thread", no emails will have the In-Reply-To
@@ -225,6 +230,10 @@ sendemail.smtppass::
 sendemail.smtpssl::
 	Boolean value specifying the default to the '--smtp-ssl' parameter.
 
+sendemail.addauthorfrom::
+	Boolean value specifying the default to the '--add-author-from'
+	parameter.
+
 Author
 ------
 Written by Ryan Anderson <ryan@michonline.com>
diff --git a/git-send-email.perl b/git-send-email.perl
index 29b1105..4d0aaac 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -94,6 +94,9 @@ Options:
 
    --suppress-from Suppress sending emails to yourself. Defaults to off.
 
+   --add-author-from Add "From:" line within message body for patch author
+                  even when author is equal to sender.
+
    --thread       Specify that the "In-Reply-To:" header should be set on all
                   emails. Defaults to on.
 
@@ -187,6 +190,7 @@ my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_ssl);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
 my ($no_validate);
 my (@suppress_cc);
+my ($force_author_from);
 
 my %config_bool_settings = (
     "thread" => [\$thread, 1],
@@ -194,6 +198,7 @@ my %config_bool_settings = (
     "suppressfrom" => [\$suppress_from, undef],
     "signedoffcc" => [\$signed_off_cc, undef],
     "smtpssl" => [\$smtp_ssl, 0],
+    "addauthorfrom" => [\$force_author_from, 0],
 );
 
 my %config_settings = (
@@ -252,6 +257,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "quiet" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "suppress-from!" => \$suppress_from,
+		    "add-author-from!" => \$force_author_from,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
 		    "dry-run" => \$dry_run,
@@ -802,6 +808,12 @@ foreach my $t (@files) {
 
 				} elsif (/^(Cc|From):\s+(.*)$/) {
 					if (unquote_rfc2047($2) eq $sender) {
+						if ($force_author_from &&
+						    $1 eq 'From') {
+							($author,
+							 $author_encoding) =
+							unquote_rfc2047($2)
+						}
 						next if ($suppress_cc{'self'});
 					}
 					elsif ($1 eq 'From') {
-- 
1.5.4.3.472.gdf7d.dirty


                 reply	other threads:[~2008-03-03  6:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=8870673.1204524015315.JavaMail.teamon@b301.teamon.com \
    --to=drafnel@gmail.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).