send-email: change --no-validate to boolean --[no-]validate

There is also now a configuration variable:

    sendemail[.<identity>].validate

Signed-off-by: Michael Witten <mfwitten@mit.edu>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Michael Witten 2008-09-30 07:58:27 -05:00 committed by Shawn O. Pearce
parent 73811e6628
commit dbf5e1e974
2 changed files with 12 additions and 6 deletions

View File

@ -182,14 +182,16 @@ configuration variable), then authentication is not attempted.
+ +
The --to option must be repeated for each user you want on the to list. The --to option must be repeated for each user you want on the to list.
--no-validate:: --[no-]validate::
Don't perform any sanity checks on patches. Perform sanity checks on patches.
Currently, validation means the following: Currently, validation means the following:
+ +
-- --
* Warn of patches that contain lines longer than 998 characters; this * Warn of patches that contain lines longer than 998 characters; this
is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt. is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
-- --
+
This option can be set with sendemail[.<identity>].validate; default to --validate
CONFIGURATION CONFIGURATION
@ -242,6 +244,9 @@ sendemail.smtpencryption::
sendemail.smtpssl:: sendemail.smtpssl::
Legacy boolean that sets 'smtpencryption=ssl' if enabled. Legacy boolean that sets 'smtpencryption=ssl' if enabled.
sendemail.validate::
Boolean override for --[no-]validate.
Author Author
------ ------
Written by Ryan Anderson <ryan@michonline.com> Written by Ryan Anderson <ryan@michonline.com>

View File

@ -65,7 +65,7 @@ Options:
--smtp-ssl * Deprecated. Use '--smtp-encryption ssl'. --smtp-ssl * Deprecated. Use '--smtp-encryption ssl'.
--quiet * Output one line of info per email. --quiet * Output one line of info per email.
--dry-run * Don't actually send the emails. --dry-run * Don't actually send the emails.
--no-validate * Don't perform sanity checks on patches. --[no-]validate * Perform patch sanity checks. Default on.
EOT EOT
exit(1); exit(1);
@ -147,7 +147,7 @@ my ($quiet, $dry_run) = (0, 0);
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd); my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption); my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts); my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
my ($no_validate); my ($validate);
my (@suppress_cc); my (@suppress_cc);
my %config_bool_settings = ( my %config_bool_settings = (
@ -155,6 +155,7 @@ my %config_bool_settings = (
"chainreplyto" => [\$chain_reply_to, 1], "chainreplyto" => [\$chain_reply_to, 1],
"suppressfrom" => [\$suppress_from, undef], "suppressfrom" => [\$suppress_from, undef],
"signedoffcc" => [\$signed_off_cc, undef], "signedoffcc" => [\$signed_off_cc, undef],
"validate" => [\$validate, 1],
); );
my %config_settings = ( my %config_settings = (
@ -221,7 +222,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"dry-run" => \$dry_run, "dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender, "envelope-sender=s" => \$envelope_sender,
"thread!" => \$thread, "thread!" => \$thread,
"no-validate" => \$no_validate, "validate!" => \$validate,
); );
unless ($rc) { unless ($rc) {
@ -374,7 +375,7 @@ for my $f (@ARGV) {
} }
} }
if (!$no_validate) { if ($validate) {
foreach my $f (@files) { foreach my $f (@files) {
unless (-p $f) { unless (-p $f) {
my $error = validate_patch($f); my $error = validate_patch($f);