Re: 'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones
On Tue, May 12, 2015 at 03:07:46PM +0200, Dmitry Malikov wrote:
Show 8 quoted lines
> I'm trying to compare 4 different git-diff algorithms and the
> 'minimal' one is the most vague and non-obvious. The documentation
> says "Spend extra time to make sure the smallest possible diff is
> produced." - that's all.
>
> By any chance, is there any example of diff when 'minimal' algorithm
> produces a different result than a 'myers', 'patience' and 'histogram'
> ones?
I don't know of a simple example offhand, but you can easily generate all of the patches for a repository with each type by doing:
for i in myers minimal patience histogram; do
git log --diff-algorithm=$i -p >$i
doneIn git.git, the output for each type is distinct. You might also find this thread interesting:
http://thread.gmane.org/gmane.comp.version-control.git/143426
It mentions 717b83117 from git.git, whose minimal diff is over 300 lines shorter than the non-minimal one. It's not exactly a simple example, but I suspect you won't find a short case; "minimal" only matters in the complicated ones.
-Peff