{"action":"created","issue":{"url":"https://api.github.com/repos/cscorley/whatthepatch/issues/2","labels_url":"https://api.github.com/repos/cscorley/whatthepatch/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/cscorley/whatthepatch/issues/2/comments","events_url":"https://api.github.com/repos/cscorley/whatthepatch/issues/2/events","html_url":"https://github.com/cscorley/whatthepatch/pull/2","id":109244203,"number":2,"title":"Bug fix for one-liner diffs","user":{"login":"thoward","id":478164,"avatar_url":"https://avatars.githubusercontent.com/u/478164?v=3","gravatar_id":"","url":"https://api.github.com/users/thoward","html_url":"https://github.com/thoward","followers_url":"https://api.github.com/users/thoward/followers","following_url":"https://api.github.com/users/thoward/following{/other_user}","gists_url":"https://api.github.com/users/thoward/gists{/gist_id}","starred_url":"https://api.github.com/users/thoward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoward/subscriptions","organizations_url":"https://api.github.com/users/thoward/orgs","repos_url":"https://api.github.com/users/thoward/repos","events_url":"https://api.github.com/users/thoward/events{/privacy}","received_events_url":"https://api.github.com/users/thoward/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-01T07:24:23Z","updated_at":"2015-10-01T08:44:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cscorley/whatthepatch/pulls/2","html_url":"https://github.com/cscorley/whatthepatch/pull/2","diff_url":"https://github.com/cscorley/whatthepatch/pull/2.diff","patch_url":"https://github.com/cscorley/whatthepatch/pull/2.patch"},"body":"This change fixes unified diff parsing to work correctly for one-liner files. Previously, the parser was giving no output in those situations. \r\n\r\nSteps to reproduce:\r\n```\r\n$ mkdir test_repo\r\n$ cd test_repo\r\n$ git init\r\n$ echo \"Adding a one-line file.\" > oneline.txt\r\n$ git commit -am \"Add a file\"\r\n$ echo \"Changed a one-line file.\" > oneline.txt\r\n$ git commit -am \"Changed a file\"\r\n$ git rm oneline.txt\r\n$ git commit -m \"Delete a file\"\r\n$ git log -p\r\n```\r\n\r\nGrab any of the diffs in that git log. None of them would parse correctly. This is because the comparison in `parse_unified_diff` of the line offsets `r`\\`i` were bypassing at `0` when no `old_len`/`new_len` value was available.\r\n\r\nI've included unit tests and casefile fixtures for this change. This does not break any other unit tests, although there are an unrelated set of 3 tests which are currently broken (as described in issue #1). \r\n\r\nSeparately, I did look into to those failing tests and I can see that these are intentional test failures, because they are testing not-yet-implemented features. Yay TDD!"},"comment":{"url":"https://api.github.com/repos/cscorley/whatthepatch/issues/comments/144657757","html_url":"https://github.com/cscorley/whatthepatch/pull/2#issuecomment-144657757","issue_url":"https://api.github.com/repos/cscorley/whatthepatch/issues/2","id":144657757,"user":{"login":"cscorley","id":112752,"avatar_url":"https://avatars.githubusercontent.com/u/112752?v=3","gravatar_id":"","url":"https://api.github.com/users/cscorley","html_url":"https://github.com/cscorley","followers_url":"https://api.github.com/users/cscorley/followers","following_url":"https://api.github.com/users/cscorley/following{/other_user}","gists_url":"https://api.github.com/users/cscorley/gists{/gist_id}","starred_url":"https://api.github.com/users/cscorley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cscorley/subscriptions","organizations_url":"https://api.github.com/users/cscorley/orgs","repos_url":"https://api.github.com/users/cscorley/repos","events_url":"https://api.github.com/users/cscorley/events{/privacy}","received_events_url":"https://api.github.com/users/cscorley/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T08:44:19Z","updated_at":"2015-10-01T08:44:19Z","body":"Great catch and PR! Thanks so much. "}}