Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report #73

Open
Marvinmw opened this issue Jun 24, 2020 · 2 comments
Open

Bug Report #73

Marvinmw opened this issue Jun 24, 2020 · 2 comments

Comments

@Marvinmw
Copy link

There is a case unidiff cannot load the diff file that have the rename file,
It outputs the error unknown trailling newline.
For example,

'From 82dd164bbedcd025ef38a2fb374dd18b90c84828 Mon Sep 17 00:00:00 2001\n', 'From: Qiujuer [email protected]\n', 'Date: Thu, 10 Jul 2014 16:34:42 +0800\n', 'Subject: [PATCH] Rename JSONHelper to JSONHelper.java\n', '\n', '---\n', ' JSONHelper => JSONHelper.java | 0\n', ' 1 file changed, 0 insertions(+), 0 deletions(-)\n', ' rename JSONHelper => JSONHelper.java (100%)\n', '\n', 'diff --git a/JSONHelper b/JSONHelper.java\n', 'similarity index 100%\n', 'rename from JSONHelper\n', 'rename to JSONHelper.java\n', '-- \n', '2.17.1\n', '\n'

@nextsilicon-itay-bookstein

Just encountered this myself, this is due to the trailing signature. Quoting from git format-patch --help:

       --[no-]signature=<signature>
           Add a signature to each message produced. Per RFC 3676 the signature is separated from the body by a line with '-- ' on it. If the signature option is omitted the signature defaults to the Git version number.

As far as I can tell, python-unidiff is trying to consume the trailing lines that belong to the signature as parts of the renamed PatchedFile. I worked around the issue by re-exporting my patches with --no-signature. I would guess that to parse this properly, the library needs to be made aware of this separator and accumulate this into a signature field on the PatchSet.

@matiasb
Copy link
Owner

matiasb commented Jul 20, 2020

Thanks for the extra details, will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants