{"thread":{"id":"35014","subject":"Searching explanation of different diff algorithms","startedAt":"2013-09-25T07:24:15Z","lastAt":"2013-09-25T15:30:45Z","messageCount":3,"participants":["Thomas Koch","Ondřej Bílka","Peter Oberndorfer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"228193","messageId":"201309250924.15741.thomas@koch.ro","threadId":"35014","inReplyTo":null,"subject":"Searching explanation of different diff algorithms","fromName":"Thomas Koch","fromEmail":"thomas@koch.ro","sentAt":"2013-09-25T07:24:15Z","receivedAt":"2013-09-25T07:24:15Z","isPatch":false,"sender":{"key":"thomas@koch.ro","avatar":null},"body":"Is there any explanation available of the different merrits and drawbacks of \nthe diff algorithms that Git supports?\n\nI'm not satisfied with the default diff but have enough processing power for a \nslower algorithm that might produce diffs that better show the intention of the \nedit.\n\nThank you, Thomas Koch\n"},{"id":"228197","messageId":"20130925085557.GA11402@domone.kolej.mff.cuni.cz","threadId":"35014","inReplyTo":"201309250924.15741.thomas@koch.ro","subject":"Re: Searching explanation of different diff algorithms","fromName":"Ondřej Bílka","fromEmail":"neleai@seznam.cz","sentAt":"2013-09-25T08:55:57Z","receivedAt":"2013-09-25T08:55:57Z","isPatch":false,"sender":{"key":"neleai@seznam.cz","avatar":"https://avatars.githubusercontent.com/u/48067?v=4"},"body":"On Wed, Sep 25, 2013 at 09:24:15AM +0200, Thomas Koch wrote:\n> Is there any explanation available of the different merrits and drawbacks of \n> the diff algorithms that Git supports?\n> \n> I'm not satisfied with the default diff but have enough processing power for a \n> slower algorithm that might produce diffs that better show the intention of the \n> edit.\n> \nIt is not just question of algorithm, even definition how should most\nreadable diff look like is problematic, for example when large block is\nrewritten and one line is unchanged then you get diff like\n\nif (x){\n- foo\n+ bar\n} else {\n- foo\n+ bar\n}\n\nbut it is better to create following diff as it does not break flow of code.\n\nif (x) {\n- foo\n-} else {\n- foo\n+ bar\n+} else {\n+ bar\n}\n"},{"id":"228215","messageId":"524301A5.2060401@arcor.de","threadId":"35014","inReplyTo":"20130925085557.GA11402@domone.kolej.mff.cuni.cz","subject":"Re: Searching explanation of different diff algorithms","fromName":"Peter Oberndorfer","fromEmail":"kumbayo84@arcor.de","sentAt":"2013-09-25T15:30:45Z","receivedAt":"2013-09-25T15:30:45Z","isPatch":false,"sender":{"key":"kumbayo84@arcor.de","avatar":"https://avatars.githubusercontent.com/u/1041267?v=4"},"body":"On 2013-09-25 10:55, Ondřej Bílka wrote:\n> On Wed, Sep 25, 2013 at 09:24:15AM +0200, Thomas Koch wrote:\n>> Is there any explanation available of the different merrits and drawbacks of \n>> the diff algorithms that Git supports?\n>>\n>> I'm not satisfied with the default diff but have enough processing power for a \n>> slower algorithm that might produce diffs that better show the intention of the \n>> edit.\n>>\n> It is not just question of algorithm, even definition how should most\n> readable diff look like is problematic, for example when large block is\n> rewritten and one line is unchanged then you get diff like\n> \n> if (x){\n> - foo\n> + bar\n> } else {\n> - foo\n> + bar\n> }\n> \n> but it is better to create following diff as it does not break flow of code.\n> \n> if (x) {\n> - foo\n> -} else {\n> - foo\n> + bar\n> +} else {\n> + bar\n> }\n\nI already asked the list for such a feature in the past[1].\nI might be able to provide a rough/unfinished hack\nthat does exactly this in a few days after cleaning it up a bit.\n\nIt works like this:\nIf 2 hunks are separated by less than a certain count of lines and\nthose lines are identified as containing no \"interesting information\"\nlike {, }, /*, */, <whitespace> then the 2 hunks are fused together.\n\nThe hack is mainly lacking the following things:\n* A way to identify boring lines.\n(a like a list of boring keywords?, per filetype?)\n* Configuration/commandline options to turn it on/off\n* Tests\n* Cleanup the code\n\nGreetings Peter\n\n[1] http://article.gmane.org/gmane.comp.version-control.git/207239/\n"}]}