diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-08-05 12:50:06 +0200 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2012-08-05 12:50:06 +0200 |
commit | b2f911bb69c9ac1b644809f98b6e5a36581e9ad8 (patch) | |
tree | b00d2b4aa24befc592296079d8d0dcd033038765 /org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java | |
parent | c0b4b79296966f53d3dd20913860942f9476dd20 (diff) | |
download | jgit-b2f911bb69c9ac1b644809f98b6e5a36581e9ad8.tar.gz jgit-b2f911bb69c9ac1b644809f98b6e5a36581e9ad8.zip |
Fix PlotCommit for commits with duplicate parents
JGit allows to create commits which have duplicate parents: e.g. a
commit X has first parent Y and second parent Y. Such commits are not
handled correctly by PlotCommit leading to wrong display of the history
in EGit. In such cases there is a never ending passing line drawn beside
all commits younger than the commit with duplicate parents. This commit
fixes this by explicitly checking for duplicate parents.
In a different commit we should fix JGit not to create commits with
duplicate parents. I think native git also doesn't allow such commits,
although history display in native git (gitk, git log --graph) is not
damaged by such commits.
Change-Id: Ie3019ef613a507023958bea27b1badc3b8950279
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java index 40e6aba11e..4a413c306a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java @@ -100,9 +100,13 @@ public class PlotCommit<L extends PlotLane> extends RevCommit { final int cnt = children.length; if (cnt == 0) children = new PlotCommit[] { c }; - else if (cnt == 1) - children = new PlotCommit[] { children[0], c }; - else { + else if (cnt == 1) { + if (!c.getId().equals(children[0].getId())) + children = new PlotCommit[] { children[0], c }; + } else { + for (PlotCommit pc : children) + if (c.getId().equals(pc.getId())) + return; final PlotCommit[] n = new PlotCommit[cnt + 1]; System.arraycopy(children, 0, n, 0, cnt); n[cnt] = c; |