{"action":"created","issue":{"url":"https://api.github.com/repos/sebastianbergmann/diff/issues/69","repository_url":"https://api.github.com/repos/sebastianbergmann/diff","labels_url":"https://api.github.com/repos/sebastianbergmann/diff/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/sebastianbergmann/diff/issues/69/comments","events_url":"https://api.github.com/repos/sebastianbergmann/diff/issues/69/events","html_url":"https://github.com/sebastianbergmann/diff/issues/69","id":264801301,"number":69,"title":"Clarification of the unified output format","user":{"login":"morozov","id":59683,"avatar_url":"https://avatars1.githubusercontent.com/u/59683?v=4","gravatar_id":"","url":"https://api.github.com/users/morozov","html_url":"https://github.com/morozov","followers_url":"https://api.github.com/users/morozov/followers","following_url":"https://api.github.com/users/morozov/following{/other_user}","gists_url":"https://api.github.com/users/morozov/gists{/gist_id}","starred_url":"https://api.github.com/users/morozov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morozov/subscriptions","organizations_url":"https://api.github.com/users/morozov/orgs","repos_url":"https://api.github.com/users/morozov/repos","events_url":"https://api.github.com/users/morozov/events{/privacy}","received_events_url":"https://api.github.com/users/morozov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-10-12T03:16:43Z","updated_at":"2017-10-12T20:35:08Z","closed_at":null,"author_association":"NONE","body":"The unified output format looks a bit different from the one implemented in GNU diff. Consider the two files:\r\n```\r\n↪  cat a.txt \r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n\r\n↪  cat b.txt \r\n1\r\n2\r\n3\r\n4\r\n5\r\n6'\r\n7\r\n8\r\n```\r\n\r\nIf compared by GNU diff, the comparison result is the following:\r\n```diff\r\n--- a.txt\t2017-10-11 12:40:59.304512847 -0700\r\n+++ b.txt\t2017-10-11 12:41:14.776322246 -0700\r\n@@ -3,6 +3,6 @@\r\n 3\r\n 4\r\n 5\r\n-6\r\n+6'\r\n 7\r\n 8\r\n```\r\nThe changed line is surrounded by unchanged lines (3 at most, by default) to represent the context.\r\n\r\nIf compared by the `Differ`, the result is the following:\r\n```diff\r\n--- Original\r\n+++ New\r\n@@ @@\r\n 1\r\n 2\r\n 3\r\n 4\r\n 5\r\n-6\r\n+6'\r\n```\r\nThe context is represented by 5 lines before and none after.\r\n\r\nIf the number of non-changed lines before the change is greater than 5 (must be controlled by `AbstractChunkOutputBuilder::getCommonChunks(int $lineThreshold)`), then they are entirely dropped:\r\n```diff\r\n--- Original\r\n+++ New\r\n@@ @@\r\n-7\r\n+7'\r\n```\r\n\r\nAt the same time, the non-changed lines after the change are dropped independently on the size of the chunk.\r\n\r\nIs this behavior by design? If yes, what's the exact meaning of `$lineThreshold`."},"comment":{"url":"https://api.github.com/repos/sebastianbergmann/diff/issues/comments/336258124","html_url":"https://github.com/sebastianbergmann/diff/issues/69#issuecomment-336258124","issue_url":"https://api.github.com/repos/sebastianbergmann/diff/issues/69","id":336258124,"user":{"login":"morozov","id":59683,"avatar_url":"https://avatars1.githubusercontent.com/u/59683?v=4","gravatar_id":"","url":"https://api.github.com/users/morozov","html_url":"https://github.com/morozov","followers_url":"https://api.github.com/users/morozov/followers","following_url":"https://api.github.com/users/morozov/following{/other_user}","gists_url":"https://api.github.com/users/morozov/gists{/gist_id}","starred_url":"https://api.github.com/users/morozov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morozov/subscriptions","organizations_url":"https://api.github.com/users/morozov/orgs","repos_url":"https://api.github.com/users/morozov/repos","events_url":"https://api.github.com/users/morozov/events{/privacy}","received_events_url":"https://api.github.com/users/morozov/received_events","type":"User","site_admin":false},"created_at":"2017-10-12T20:35:08Z","updated_at":"2017-10-12T20:35:08Z","author_association":"NONE","body":"@SpacePossum there's no need to make any updates to `diff 1.4`, it already displays the context lines. My only question is, can `diff 2.0` be fixed in a way that it also displays them?"}}
{"actor":{"display_login":"morozov"}}