{"thread":{"id":"39309","subject":"'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones","startedAt":"2015-05-12T13:07:46Z","lastAt":"2015-05-24T07:33:39Z","messageCount":2,"participants":["Dmitry Malikov","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"261047","messageId":"CAAg4OeLuR9NY1NaEsjqd4hbuLqZuUo7j+BsVvQT37APY_QEYUQ@mail.gmail.com","threadId":"39309","inReplyTo":null,"subject":"'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones","fromName":"Dmitry Malikov","fromEmail":"malikov.d.y@gmail.com","sentAt":"2015-05-12T13:07:46Z","receivedAt":"2015-05-12T13:07:46Z","isPatch":false,"sender":{"key":"malikov.d.y@gmail.com","avatar":null},"body":"Good day,\n\nI'm trying to compare 4 different git-diff algorithms and the\n'minimal' one is the most vague and non-obvious. The documentation\nsays \"Spend extra time to make sure the smallest possible diff is\nproduced.\" - that's all.\n\nBy any chance, is there any example of diff when 'minimal' algorithm\nproduces a different result than a 'myers', 'patience' and 'histogram'\nones?\n\nPS: in case of a question like 'why do you need that?' - it's for\ntesting purposes of some git wrapper library.\n"},{"id":"262011","messageId":"20150524073338.GA7197@peff.net","threadId":"39309","inReplyTo":"CAAg4OeLuR9NY1NaEsjqd4hbuLqZuUo7j+BsVvQT37APY_QEYUQ@mail.gmail.com","subject":"Re: 'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-24T07:33:39Z","receivedAt":"2015-05-24T07:33:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 12, 2015 at 03:07:46PM +0200, Dmitry Malikov wrote:\n\n> I'm trying to compare 4 different git-diff algorithms and the\n> 'minimal' one is the most vague and non-obvious. The documentation\n> says \"Spend extra time to make sure the smallest possible diff is\n> produced.\" - that's all.\n> \n> By any chance, is there any example of diff when 'minimal' algorithm\n> produces a different result than a 'myers', 'patience' and 'histogram'\n> ones?\n\nI don't know of a simple example offhand, but you can easily generate\nall of the patches for a repository with each type by doing:\n\n  for i in myers minimal patience histogram; do\n    git log --diff-algorithm=$i -p >$i\n  done\n\nIn git.git, the output for each type is distinct. You might also find\nthis thread interesting:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/143426\n\nIt mentions 717b83117 from git.git, whose minimal diff is over 300 lines\nshorter than the non-minimal one. It's not exactly a simple example, but\nI suspect you won't find a short case; \"minimal\" only matters in the\ncomplicated ones.\n\n-Peff\n"}]}