{"thread":{"id":"26427","subject":"[PATCH] send-email: add 'specify-author' option","startedAt":"2011-02-06T14:44:05Z","lastAt":"2011-02-06T14:44:05Z","messageCount":1,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"160495","messageId":"1297003445-23652-1-git-send-email-felipe.contreras@gmail.com","threadId":"26427","inReplyTo":null,"subject":"[PATCH] send-email: add 'specify-author' option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2011-02-06T14:44:05Z","receivedAt":"2011-02-06T14:44:05Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"From: Felipe Contreras <felipe.contreras@gmail.com>\n\nAlways specify the author of the commit in the body of the message, even\nif the committer is the author.\n\nThis is useful if the 'From' header is mangled by some mail server.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-send-email.txt |    4 ++++\n git-send-email.perl              |    7 ++++++-\n t/t9001-send-email.sh            |   12 ++++++++++++\n 3 files changed, 22 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 7ec9dab..5895835 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -125,6 +125,10 @@ The --to option must be repeated for each user you want on the to list.\n +\n Note that no attempts whatsoever are made to validate the encoding.\n \n+--specify-author::\n+\tAlways specify the author of the commit in the body of the message,\n+\teven if the committer is the author. This is useful if the 'From'\n+\theader is mangled by some mail server.\n \n Sending\n ~~~~~~~\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 76565de..30f27ff 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -57,6 +57,8 @@ git send-email [options] <file | directory | rev-list options >\n     --annotate                     * Review each patch that will be sent in an editor.\n     --compose                      * Open an editor for introduction.\n     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared\n+    --specify-author               * Always specify the author of the commit in\n+\t\t\t             the body of the message.\n \n   Sending:\n     --envelope-sender       <str>  * Email envelope sender.\n@@ -198,6 +200,7 @@ my ($identity, $aliasfiletype, @alias_files, $smtp_domain);\n my ($validate, $confirm);\n my (@suppress_cc);\n my ($auto_8bit_encoding);\n+my ($specify_author);\n \n my ($debug_net_smtp) = 0;\t\t# Net::SMTP, see send_message()\n \n@@ -210,6 +213,7 @@ my %config_bool_settings = (\n     \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n     \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n     \"validate\" => [\\$validate, 1],\n+    \"specifyauthor\" => [\\$specify_author, undef],\n );\n \n my %config_settings = (\n@@ -311,6 +315,7 @@ my $rc = GetOptions(\"sender|from=s\" => \\$sender,\n \t\t    \"format-patch!\" => \\$format_patch,\n \t\t    \"8bit-encoding=s\" => \\$auto_8bit_encoding,\n \t\t    \"force\" => \\$force,\n+\t\t    \"specify-author!\" => \\$specify_author,\n \t );\n \n unless ($rc) {\n@@ -1285,7 +1290,7 @@ foreach my $t (@files) {\n \t\t$subject = quote_rfc2047($subject, $auto_8bit_encoding);\n \t}\n \n-\tif (defined $author and $author ne $sender) {\n+\tif (defined $author and ($author ne $sender or $specify_author)) {\n \t\t$message = \"From: $author\\n\\n$message\";\n \t\tif (defined $author_encoding) {\n \t\t\tif ($has_content_type) {\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 579ddb7..66d2541 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -280,6 +280,18 @@ test_expect_success $PREREQ 'Author From: not in message body' '\n \t! grep \"From: A <author@example.com>\" msgbody1\n '\n \n+test_expect_success $PREREQ 'Author From: in message body (forced)' '\n+\tclean_fake_sendmail &&\n+\tgit send-email \\\n+\t\t--from=\"A <author@example.com>\" \\\n+\t\t--to=nobody@example.com \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\t--specify-author \\\n+\t\t$patches &&\n+\tsed \"1,/^\\$/d\" < msgtxt1 > msgbody1 &&\n+\tgrep \"From: A <author@example.com>\" msgbody1\n+'\n+\n test_expect_success $PREREQ 'allow long lines with --no-validate' '\n \tgit send-email \\\n \t\t--from=\"Example <nobody@example.com>\" \\\n-- \n1.7.4.1.gf4271.dirty\n"}]}