• Arkadiusz Hiler's avatar
    Don't mangle \n and \r combinations in the generated mboxes · 189b72f2
    Arkadiusz Hiler authored
    Generated mboxes weren't representing newline (aka LF or \n) and
    carriage return (aka CR or \r) found in the original patch faithfully.
    
    This is mostly due to how email.Message is implemented - it tries to
    normalize newlines in plain text emails. This doesn't work for us as we
    want to provide the patches in an unchanged form.
    
    To do that we have to overwrite as_string() and as_bytes() methods on
    our Message class that will use modified Generator that doesn't mangle
    newlines.
    
    The difference in the checksums is due to slightly different header
    wrapping caused by the changes in generator.
    
    Additionally tests are provided to make sure that we ingest emails
    correctly (no mangling there) and that the generated mbox is also
    a-okay.
    
    Fixes: #33Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
    189b72f2
test_patchparser.py 42.3 KB