diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2010-11-26 00:30:08 +0100 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2010-11-26 00:30:08 +0100 |
commit | 049827d7080201fe24f2728b26d681434327f72a (patch) | |
tree | ffb4bc655c9ea98ed62e8194ecd6acca407cd912 /org.eclipse.jgit.pgm | |
parent | 7e298c9ed538dd8d5207adce3497b4a1df701dc5 (diff) | |
download | jgit-049827d7080201fe24f2728b26d681434327f72a.tar.gz jgit-049827d7080201fe24f2728b26d681434327f72a.zip |
Make diff algorithm configurable
The diff algorithm which is used by Merge, Cherry-Pick, Rebase
should be configurable. A new configuration parameter "diff.algorithm"
is introduced which currently accepts the values "myers" or
"histogram". Based on this parameter for example the ResolveMerger
will choose a diff algorithm. The reason for this is bug 331078.
This bug shows that JGit is more compatible with C Git when
histogram diff is in place. But since histogram diff is quite new we
need an easy way to fall back to Myers diff.
Bug: 331078
Change-Id: I2549c992e478d991c61c9508ad826d1a9e539ae3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java index 6062f35827..506031713a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java @@ -54,10 +54,9 @@ import java.text.MessageFormat; import java.util.List; import org.eclipse.jgit.diff.DiffAlgorithm; +import org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm; import org.eclipse.jgit.diff.DiffEntry; import org.eclipse.jgit.diff.DiffFormatter; -import org.eclipse.jgit.diff.HistogramDiff; -import org.eclipse.jgit.diff.MyersDiff; import org.eclipse.jgit.diff.RawTextComparator; import org.eclipse.jgit.diff.RenameDetector; import org.eclipse.jgit.dircache.DirCacheIterator; @@ -101,19 +100,9 @@ class Diff extends TextBuiltin { detectRenames = Boolean.FALSE; } - enum SupportedAlgorithm { - myers(MyersDiff.INSTANCE), histogram(new HistogramDiff()); - - public DiffAlgorithm algorithm; - - SupportedAlgorithm(DiffAlgorithm a) { - algorithm = a; - } - }; - @Option(name = "--algorithm", metaVar = "metaVar_diffAlg", usage = "usage_diffAlgorithm") void setAlgorithm(SupportedAlgorithm s) { - diffFmt.setDiffAlgorithm(s.algorithm); + diffFmt.setDiffAlgorithm(DiffAlgorithm.getAlgorithm(s)); } @Option(name = "-l", usage = "usage_renameLimit") |