@matheusbsbs / matheus-bagliano / commits / c764a0c2b6
Fork 0

send-email: add no-validate option

Since we are now sanity-checking the contents of patches and refusing to send ones with long lines, this knob provides a way for the user to override the new behavior (if, e.g., he knows his SMTP path will handle it). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jan 18, 2008 at 09:20 UTC c764a0c2b6d8c94d90c95fa8170970c85a40665c
2 files changed +19 -3
git-send-email.perl
+9 -3
@@ -100,6 +100,8 @@ Options:
100
101 --envelope-sender Specify the envelope sender used to send the emails.
102
103 + --no-validate Don't perform any sanity checks on patches.
104 +
105 EOT
106 exit(1);
107 }
@@ -177,6 +179,7 @@ my ($quiet, $dry_run) = (0, 0);
179 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
180 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_authpass, $smtp_ssl);
181 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
182 +my ($no_validate);
183
184 my %config_bool_settings = (
185 "thread" => [\$thread, 1],
@@ -222,6 +225,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
225 "dry-run" => \$dry_run,
226 "envelope-sender=s" => \$envelope_sender,
227 "thread!" => \$thread,
228 + "no-validate" => \$no_validate,
229 );
230
231 unless ($rc) {
@@ -332,9 +336,11 @@ for my $f (@ARGV) {
336 }
337 }
338
335 -foreach my $f (@files) {
336 - my $error = validate_patch($f);
337 - $error and die "fatal: $f: $error\nwarning: no patches were sent\n";
339 +if (!$no_validate) {
340 + foreach my $f (@files) {
341 + my $error = validate_patch($f);
342 + $error and die "fatal: $f: $error\nwarning: no patches were sent\n";
343 + }
344 }
345
346 if (@files) {
t/t9001-send-email.sh
+10
@@ -98,4 +98,14 @@ test_expect_success 'no patch was sent' '
98 ! test -e commandline
99 '
100
101 +test_expect_success 'allow long lines with --no-validate' '
102 + git send-email \
103 + --from="Example <nobody@example.com>" \
104 + --to=nobody@example.com \
105 + --smtp-server="$(pwd)/fake.sendmail" \
106 + --no-validate \
107 + $patches longline.patch \
108 + 2>errors
109 +'
110 +
111 test_done