{"thread":{"id":"12451","subject":"[PATCH] git-send-email: add option to force a From: line within the message body","startedAt":"2008-03-03T06:00:43Z","lastAt":"2008-03-03T06:00:43Z","messageCount":1,"participants":["drafnel@gmail.com"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"70742","messageId":"8870673.1204524015315.JavaMail.teamon@b301.teamon.com","threadId":"12451","inReplyTo":null,"subject":"[PATCH] git-send-email: add option to force a From: line within the message body","fromName":"","fromEmail":"drafnel@gmail.com","sentAt":"2008-03-03T06:00:43Z","receivedAt":"2008-03-03T06:00:43Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nAdd a new command line option --add-author-from and a config option\nsendemail.addauthorfrom which will ensure that a From: line is added\nto the message body regardless of whether the sender email matches the\nFrom: line parsed from the supplied patch (i.e. the patch author).\n\nThis provides a work-around for mail gateways which override the From:\nline of submitted messages.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n\nI don't know if anyone else has the same problem, but I sometimes use a\nmail gateway which forces a certain From: line overriding what is\nsupplied in the email. So, for me, the solution this patch provides could\nbe achieved by just typing in some bogus string when git-send-email prompts\nfor the From address, but this patch is more convenient and more general.\n\n-brandon\n\n\n Documentation/git-send-email.txt |    9 +++++++++\n git-send-email.perl              |   12 ++++++++++++\n 2 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 336d797..e3267de 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -157,6 +157,11 @@ user is prompted for a password while the input is masked for privacy.\n \tif that is unspecified, default to 'self' if --suppress-from is\n \tspecified, as well as 'sob' if --no-signed-off-cc is specified.\n \n+--add-author-from::\n+\tAdd a \"From:\" line within the message body describing the patch\n+\tauthor even if the author is equal to the sender. Usually, a \"From:\"\n+\tline is added only when the author differs from the sender.\n+\n --thread, --no-thread::\n \tIf this is set, the In-Reply-To header will be set on each email sent.\n \tIf disabled with \"--no-thread\", no emails will have the In-Reply-To\n@@ -225,6 +230,10 @@ sendemail.smtppass::\n sendemail.smtpssl::\n \tBoolean value specifying the default to the '--smtp-ssl' parameter.\n \n+sendemail.addauthorfrom::\n+\tBoolean value specifying the default to the '--add-author-from'\n+\tparameter.\n+\n Author\n ------\n Written by Ryan Anderson <ryan@michonline.com>\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 29b1105..4d0aaac 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -94,6 +94,9 @@ Options:\n \n    --suppress-from Suppress sending emails to yourself. Defaults to off.\n \n+   --add-author-from Add \"From:\" line within message body for patch author\n+                  even when author is equal to sender.\n+\n    --thread       Specify that the \"In-Reply-To:\" header should be set on all\n                   emails. Defaults to on.\n \n@@ -187,6 +190,7 @@ my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_ssl);\n my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);\n my ($no_validate);\n my (@suppress_cc);\n+my ($force_author_from);\n \n my %config_bool_settings = (\n     \"thread\" => [\\$thread, 1],\n@@ -194,6 +198,7 @@ my %config_bool_settings = (\n     \"suppressfrom\" => [\\$suppress_from, undef],\n     \"signedoffcc\" => [\\$signed_off_cc, undef],\n     \"smtpssl\" => [\\$smtp_ssl, 0],\n+    \"addauthorfrom\" => [\\$force_author_from, 0],\n );\n \n my %config_settings = (\n@@ -252,6 +257,7 @@ my $rc = GetOptions(\"sender|from=s\" => \\$sender,\n \t\t    \"quiet\" => \\$quiet,\n \t\t    \"cc-cmd=s\" => \\$cc_cmd,\n \t\t    \"suppress-from!\" => \\$suppress_from,\n+\t\t    \"add-author-from!\" => \\$force_author_from,\n \t\t    \"suppress-cc=s\" => \\@suppress_cc,\n \t\t    \"signed-off-cc|signed-off-by-cc!\" => \\$signed_off_cc,\n \t\t    \"dry-run\" => \\$dry_run,\n@@ -802,6 +808,12 @@ foreach my $t (@files) {\n \n \t\t\t\t} elsif (/^(Cc|From):\\s+(.*)$/) {\n \t\t\t\t\tif (unquote_rfc2047($2) eq $sender) {\n+\t\t\t\t\t\tif ($force_author_from &&\n+\t\t\t\t\t\t    $1 eq 'From') {\n+\t\t\t\t\t\t\t($author,\n+\t\t\t\t\t\t\t $author_encoding) =\n+\t\t\t\t\t\t\tunquote_rfc2047($2)\n+\t\t\t\t\t\t}\n \t\t\t\t\t\tnext if ($suppress_cc{'self'});\n \t\t\t\t\t}\n \t\t\t\t\telsif ($1 eq 'From') {\n-- \n1.5.4.3.472.gdf7d.dirty\n\n"}]}