cscorley / whatthepatch

What The Patch!? -- A Python patch parsing library
MIT License
64 stars 24 forks source link

If newly added file is empty in Git then parse_patch fails to recognize it. #18

Closed momalepd closed 4 years ago

momalepd commented 6 years ago

Possible fix is at this line: https://github.com/cscorley/whatthepatch/blob/master/whatthepatch/patch.py#L198

Condition should be "while len(lines) > 0:"

Issue:

The diff for empty file creation looks like this: diff --git a/sample-code/empty_file b/sample-code/empty_file new file mode 100644 index 0000000..e69de29

graingert commented 5 years ago

@momalepd can you make a PR and unit test for this?

ronnyli commented 5 years ago

Hi I came here to post this exact issue! Looks like it's been fixed already and now you're at version 0.0.6. However, when I try to upgrade through pip it says that I'm on the latest version (0.0.5). Am I doing something wrong or is it on PyPi's side?

cscorley commented 5 years ago

I have yet to push the publish button. I was going to attempt to include another issue but got behind.

On Thu, May 16, 2019, 11:10 AM ronnyli notifications@github.com wrote:

Hi I came here to post this exact issue! Looks like it's been fixed already and now you're at version 0.0.6. However, when I try to upgrade through pip it says that I'm on the latest version (0.0.5). Am I doing something wrong or is it on PyPi's side?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/cscorley/whatthepatch/issues/18?email_source=notifications&email_token=AAA3Q4DR5LYDAD7SEJSOUATPVV2PDA5CNFSM4FXN7EFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVSD3AA#issuecomment-493108608, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA3Q4ALNUBGSMYEDC5DS5TPVV2PDANCNFSM4FXN7EFA .