aboutsummaryrefslogtreecommitdiffstats
path: root/main/git/0001-senddata-16K-workaround.patch
blob: 341a2a2e825d6a9b540239cf2f43223ef052acc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/git-send-email.perl b/git-send-email.perl
index ae9f869..b11dce8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1365,7 +1365,14 @@ Message-Id: $message_id
 		$smtp->mail( $raw_from ) or die $smtp->message;
 		$smtp->to( @recipients ) or die $smtp->message;
 		$smtp->data or die $smtp->message;
-		$smtp->datasend("$header\n$message") or die $smtp->message;
+		# Apparently datasend cannot send more than about 16 and large patches
+		# cannot be sent.  Source:
+		# http://git.661346.n2.nabble.com/git-send-email-Connection-Closed-td7635648.html
+		$smtp->datasend("$header\n") or die $smtp->message;
+		my @lines = split /^/, $message;
+		foreach my $line (@lines) {
+			$smtp->datasend("$line") or die $smtp->message;
+		}
 		$smtp->dataend() or die $smtp->message;
 		$smtp->code =~ /250|200/ or die "Failed to send $subject\n".$smtp->message;
 	}