* [PATCH] send-email: automatic envelope sender
@ 2009-11-26 19:04 Felipe Contreras
2009-11-27 2:34 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Felipe Contreras @ 2009-11-26 19:04 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Felipe Contreras
This adds the option to specify the envelope sender as "auto" which
would pick the 'from' address. This is good because now we can specify
the address only in one place (and change it easily).
Comments by Junio C Hamano.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
Documentation/git-send-email.txt | 7 ++++---
git-send-email.perl | 6 +++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c85d7f4..8c482f4 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -108,9 +108,10 @@ Sending
--envelope-sender=<address>::
Specify the envelope sender used to send the emails.
This is useful if your default address is not the address that is
- subscribed to a list. If you use the sendmail binary, you must have
- suitable privileges for the -f parameter. Default is the value of
- the 'sendemail.envelopesender' configuration variable; if that is
+ subscribed to a list. In order to use the 'From' address, set the
+ value to "auto". If you use the sendmail binary, you must have
+ suitable privileges for the -f parameter. Default is the value of the
+ 'sendemail.envelopesender' configuration variable; if that is
unspecified, choosing the envelope sender is left to your MTA.
--smtp-encryption=<encryption>::
diff --git a/git-send-email.perl b/git-send-email.perl
index 4f5da4e..da2e56e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -862,7 +862,11 @@ X-Mailer: git-send-email $gitversion
my @sendmail_parameters = ('-i', @recipients);
my $raw_from = $sanitized_sender;
- $raw_from = $envelope_sender if (defined $envelope_sender);
+ if (defined $envelope_sender) {
+ if (not $envelope_sender eq "auto") {
+ $raw_from = $envelope_sender;
+ }
+ }
$raw_from = extract_valid_address($raw_from);
unshift (@sendmail_parameters,
'-f', $raw_from) if(defined $envelope_sender);
--
1.6.6.rc0.61.geeb75
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] send-email: automatic envelope sender
2009-11-26 19:04 [PATCH] send-email: automatic envelope sender Felipe Contreras
@ 2009-11-27 2:34 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-11-27 2:34 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git
Felipe Contreras <felipe.contreras@gmail.com> writes:
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 4f5da4e..da2e56e 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -862,7 +862,11 @@ X-Mailer: git-send-email $gitversion
>
> my @sendmail_parameters = ('-i', @recipients);
> my $raw_from = $sanitized_sender;
> - $raw_from = $envelope_sender if (defined $envelope_sender);
> + if (defined $envelope_sender) {
> + if (not $envelope_sender eq "auto") {
> + $raw_from = $envelope_sender;
> + }
> + }
Thanks.
I'd rewrite this to
if (defined $envelope_sender && $envelope_sender ne "auto") {
...
}
but otherwise the patch looks quite straightforward.
Tests?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-27 2:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-26 19:04 [PATCH] send-email: automatic envelope sender Felipe Contreras
2009-11-27 2:34 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox