The patch parser splits emails incorrectly when the comment contains a
line whose first word starts with "diff" (like "difficult" or
"different").
For a real-life example of an email that triggers this bug, see
http://patchwork.ozlabs.org/patch/135291/.
Fix the issue by checking for a space after "diff". Add
DiffWordInCommentTest to the test suite.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
line += '\n'
if state == 0:
- if line.startswith('diff') or line.startswith('===') \
+ if line.startswith('diff ') or line.startswith('===') \
or line.startswith('Index: '):
state = 1
buf += line
(self.patch, self.comment) = find_content(self.project, email)
+class DiffWordInCommentTest(InlinePatchTest):
+ test_comment = 'Lines can start with words beginning in "diff"\n' + \
+ 'difficult\nDifferent'
+
+
class UpdateCommentTest(InlinePatchTest):
""" Test for '---\nUpdate: v2' style comments to patches. """
patch_filename = '0001-add-line.patch'