summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl17
1 files changed, 17 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 7a86977ef1..4e62c3f0e7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -332,6 +332,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 (@files) {
unless ($quiet) {
print $_,"\n" for (@files);
@@ -837,3 +842,15 @@ sub unique_email_list(@) {
}
return @emails;
}
+
+sub validate_patch {
+ my $fn = shift;
+ open(my $fh, '<', $fn)
+ or die "unable to open $fn: $!\n";
+ while (my $line = <$fh>) {
+ if (length($line) > 998) {
+ return "$.: patch contains a line longer than 998 characters";
+ }
+ }
+ return undef;
+}