]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiInput.pm
lei rediff: regenerate diffs from stdin
[public-inbox.git] / lib / PublicInbox / LeiInput.pm
index 46eea1118394abb2af004f13870a5f67d450a05c..8708356491965cbb1214c76d2d2249408b927430 100644 (file)
@@ -69,6 +69,12 @@ error reading $name: $!
                # but no Content-Length or "From " escaping.
                # "git format-patch" also generates such files by default.
                $buf =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+
+               # a user may feed just a body: git diff | lei rediff -U9
+               if ($self->{-force_eml}) {
+                       my $eml = PublicInbox::Eml->new($buf);
+                       substr($buf, 0, 0) = "\n\n" if !$eml->{bdy};
+               }
                $self->input_eml_cb(PublicInbox::Eml->new(\$buf), @args);
        } else {
                # prepare_inputs already validated $ifmt