[Patchew-devel] [PATCH] mbox: recognize patch consisting entirely of GIT binary diffs

Paolo Bonzini pbonzini at redhat.com
Sun May 5 23:56:06 UTC 2019


A patch consisting entirely of binary diffs is not recognized by
Patch. Make Mbox.is_patch detect binary diffs to fix it.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 mbox.py | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/mbox.py b/mbox.py
index 47a770f..16b3fc9 100644
--- a/mbox.py
+++ b/mbox.py
@@ -253,18 +253,9 @@ class MboxMessage(object):
         body = self.get_body()
         if self.get_subject().startswith("Re:"):
             return False
-        return self._has_lines(body,
-                               "---",
-                               "diff ",
-                               "index ",
-                               "---",
-                               "+++",
-                               "@@") or \
-               self._has_lines(body,
-                               "---",
-                               "diff ",
-                               "old mode ",
-                               "new mode ")
+        return self._has_lines(body, "---", "diff ", "index ", "---", "+++", "@@") or \
+               self._has_lines(body, "---", "diff ", "index ", "GIT binary patch") or \
+               self._has_lines(body, "---", "diff ", "old mode ", "new mode ")
 
     def is_series_head(self):
         """Create and return a Series from Message if it is one, otherwise
-- 
2.21.0




More information about the Patchew-devel mailing list