git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* 'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones
@ 2015-05-12 13:07 Dmitry Malikov
  2015-05-24  7:33 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Malikov @ 2015-05-12 13:07 UTC (permalink / raw)
  To: git

Good day,

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?

PS: in case of a question like 'why do you need that?' - it's for
testing purposes of some git wrapper library.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones
  2015-05-12 13:07 'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones Dmitry Malikov
@ 2015-05-24  7:33 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2015-05-24  7:33 UTC (permalink / raw)
  To: Dmitry Malikov; +Cc: git

On Tue, May 12, 2015 at 03:07:46PM +0200, Dmitry Malikov wrote:

> 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
  done

In 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-24  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 13:07 'Minimal' diff-algorithm producing a different result than 'myers', 'patience' and 'histogram' ones Dmitry Malikov
2015-05-24  7:33 ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).