From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH] send-email: add 'specify-author' option
Date: Sun, 6 Feb 2011 16:44:05 +0200 [thread overview]
Message-ID: <1297003445-23652-1-git-send-email-felipe.contreras@gmail.com> (raw)
From: Felipe Contreras <felipe.contreras@gmail.com>
Always specify the author of the commit in the body of the message, even
if the committer is the author.
This is useful if the 'From' header is mangled by some mail server.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
Documentation/git-send-email.txt | 4 ++++
git-send-email.perl | 7 ++++++-
t/t9001-send-email.sh | 12 ++++++++++++
3 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 7ec9dab..5895835 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -125,6 +125,10 @@ The --to option must be repeated for each user you want on the to list.
+
Note that no attempts whatsoever are made to validate the encoding.
+--specify-author::
+ Always specify the author of the commit in the body of the message,
+ even if the committer is the author. This is useful if the 'From'
+ header is mangled by some mail server.
Sending
~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 76565de..30f27ff 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -57,6 +57,8 @@ git send-email [options] <file | directory | rev-list options >
--annotate * Review each patch that will be sent in an editor.
--compose * Open an editor for introduction.
--8bit-encoding <str> * Encoding to assume 8bit mails if undeclared
+ --specify-author * Always specify the author of the commit in
+ the body of the message.
Sending:
--envelope-sender <str> * Email envelope sender.
@@ -198,6 +200,7 @@ my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
my ($validate, $confirm);
my (@suppress_cc);
my ($auto_8bit_encoding);
+my ($specify_author);
my ($debug_net_smtp) = 0; # Net::SMTP, see send_message()
@@ -210,6 +213,7 @@ my %config_bool_settings = (
"signedoffbycc" => [\$signed_off_by_cc, undef],
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
"validate" => [\$validate, 1],
+ "specifyauthor" => [\$specify_author, undef],
);
my %config_settings = (
@@ -311,6 +315,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"format-patch!" => \$format_patch,
"8bit-encoding=s" => \$auto_8bit_encoding,
"force" => \$force,
+ "specify-author!" => \$specify_author,
);
unless ($rc) {
@@ -1285,7 +1290,7 @@ foreach my $t (@files) {
$subject = quote_rfc2047($subject, $auto_8bit_encoding);
}
- if (defined $author and $author ne $sender) {
+ if (defined $author and ($author ne $sender or $specify_author)) {
$message = "From: $author\n\n$message";
if (defined $author_encoding) {
if ($has_content_type) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 579ddb7..66d2541 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -280,6 +280,18 @@ test_expect_success $PREREQ 'Author From: not in message body' '
! grep "From: A <author@example.com>" msgbody1
'
+test_expect_success $PREREQ 'Author From: in message body (forced)' '
+ clean_fake_sendmail &&
+ git send-email \
+ --from="A <author@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ --specify-author \
+ $patches &&
+ sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
+ grep "From: A <author@example.com>" msgbody1
+'
+
test_expect_success $PREREQ 'allow long lines with --no-validate' '
git send-email \
--from="Example <nobody@example.com>" \
--
1.7.4.1.gf4271.dirty
reply other threads:[~2011-02-06 14:44 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=1297003445-23652-1-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@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