git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	Adam Piatyszek <ediap@users.sourceforge.net>,
	git@vger.kernel.org
Subject: [PATCH 3/3] send-email: add no-validate option
Date: Fri, 18 Jan 2008 09:20:10 -0500	[thread overview]
Message-ID: <20080118142010.GC19783@coredump.intra.peff.net> (raw)
In-Reply-To: <20080118141638.GA14928@coredump.intra.peff.net>

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>
---
 git-send-email.perl   |   12 +++++++++---
 t/t9001-send-email.sh |   10 ++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 144d7d4..39e0222 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -100,6 +100,8 @@ Options:
 
    --envelope-sender	Specify the envelope sender used to send the emails.
 
+   --no-validate	Don't perform any sanity checks on patches.
+
 EOT
 	exit(1);
 }
@@ -177,6 +179,7 @@ my ($quiet, $dry_run) = (0, 0);
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_authpass, $smtp_ssl);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
+my ($no_validate);
 
 my %config_bool_settings = (
     "thread" => [\$thread, 1],
@@ -222,6 +225,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
+		    "no-validate" => \$no_validate,
 	 );
 
 unless ($rc) {
@@ -332,9 +336,11 @@ for my $f (@ARGV) {
 	}
 }
 
-foreach my $f (@files) {
-	my $error = validate_patch($f);
-	$error and die "fatal: $f: $error\nwarning: no patches were sent\n";
+if (!$no_validate) {
+	foreach my $f (@files) {
+		my $error = validate_patch($f);
+		$error and die "fatal: $f: $error\nwarning: no patches were sent\n";
+	}
 }
 
 if (@files) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1c41810..4f6822f 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -98,4 +98,14 @@ test_expect_success 'no patch was sent' '
 	! test -e commandline
 '
 
+test_expect_success 'allow long lines with --no-validate' '
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
+		$patches longline.patch \
+		2>errors
+'
+
 test_done
-- 
1.5.4.rc3.1128.g1826-dirty

  parent reply	other threads:[~2008-01-18 14:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17 10:10 [BUG] git send-email brakes patches with very long lines Adam Piatyszek
2008-01-17 13:13 ` Adam Piatyszek
2008-01-17 13:26   ` Adam Piatyszek
2008-01-17 15:32     ` Jeff King
2008-01-18  7:47       ` [PATCH] git-send-email.perl: check for lines longer than 998 characters Adam Piątyszek
2008-01-18  8:12         ` Johannes Sixt
2008-01-18  9:42           ` Adam Piatyszek
2008-01-18 10:01             ` Johannes Sixt
2008-01-18 10:08               ` Junio C Hamano
2008-01-18 10:37                 ` Adam Piatyszek
2008-01-18 11:01                   ` Junio C Hamano
2008-01-18 14:16                 ` Jeff King
2008-01-18 14:19                   ` [PATCH 1/3] send-email: detect invocation errors earlier Jeff King
2008-01-18 14:19                   ` [PATCH 2/3] send-email: validate patches before sending anything Jeff King
2008-01-18 15:09                     ` Johannes Sixt
2008-01-18 19:09                       ` Jeff King
2008-01-18 17:39                     ` Jay Soffian
2008-01-18 19:12                       ` Jeff King
2008-01-18 14:20                   ` Jeff King [this message]
2008-01-18 20:57                   ` [PATCH] git-send-email.perl: check for lines longer than 998 characters Junio C Hamano
2008-01-18 21:30                     ` Jeff King
2008-01-20 22:35                     ` Adam Piatyszek
2008-01-20 22:53                       ` Jeff King
2008-01-21 10:21                         ` Adam Piatyszek

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=20080118142010.GC19783@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=ediap@users.sourceforge.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    /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;
as well as URLs for NNTP newsgroup(s).