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

Philippe Mathieu-Daudé philmd at redhat.com
Mon May 6 10:42:57 UTC 2019


On 5/6/19 1:56 AM, Paolo Bonzini wrote:
> 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>

Reviewed-by: Philippe Mathieu-Daudé <philmd 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
> 




More information about the Patchew-devel mailing list