tools: patman: Generate cover letter correctly when 'END' is missing
authorBin Meng <bmeng.cn@gmail.com>
Mon, 27 Jun 2016 06:24:30 +0000 (23:24 -0700)
committerSimon Glass <sjg@chromium.org>
Mon, 11 Jul 2016 20:06:44 +0000 (14:06 -0600)
If 'END' is missing in a 'Cover-letter' section, and that section
happens to show up at the very end of the commit message, and the
commit is the last commit of the series, patman fails to generate
cover letter for us. Handle this in CloseCommit of patchstream.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/patman/patchstream.py

index ce8ffb86bf34d93e97aeef8f284df70932d278f6..9ae977f2dfeae2c894ceee66d94d7270fe5ed7ed 100644 (file)
@@ -112,6 +112,14 @@ class PatchStream:
         if self.commit and self.is_log:
             self.series.AddCommit(self.commit)
             self.commit = None
+        # If 'END' is missing in a 'Cover-letter' section, and that section
+        # happens to show up at the very end of the commit message, this is
+        # the chance for us to fix it up.
+        if self.in_section == 'cover' and self.is_log:
+            self.series.cover = self.section
+            self.in_section = None
+            self.skip_blank = True
+            self.section = []
 
     def ProcessLine(self, line):
         """Process a single line of a patch file or commit log