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 a068943fb..dc9e0321f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java @@ -65,19 +65,16 @@ public class PlotCommit extends RevCommit { PlotCommit[] children; - final Ref[] refs; + Ref[] refs; /** * Create a new commit. * * @param id * the identity of this commit. - * @param tags - * the tags associated with this commit, null for no tags */ - protected PlotCommit(final AnyObjectId id, final Ref[] tags) { + protected PlotCommit(final AnyObjectId id) { super(id); - this.refs = tags; passingLanes = NO_LANES; children = NO_CHILDREN; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java index 666cb0287..c69e66cb8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java @@ -45,12 +45,15 @@ package org.eclipse.jgit.revplot; import java.io.IOException; +import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Map; import java.util.Set; import org.eclipse.jgit.JGitText; +import org.eclipse.jgit.errors.IncorrectObjectTypeException; +import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; @@ -93,23 +96,26 @@ public void sort(final RevSort s, final boolean use) { @Override protected RevCommit createCommit(final AnyObjectId id) { - return new PlotCommit(id, getTags(id)); + return new PlotCommit(id); } - /** - * @param commitId - * @return return the list of knows tags referring to this commit - */ - protected Ref[] getTags(final AnyObjectId commitId) { + @Override + public RevCommit next() throws MissingObjectException, + IncorrectObjectTypeException, IOException { + PlotCommit pc = (PlotCommit) super.next(); + if (pc != null) + pc.refs = getTags(pc); + return pc; + } + + private Ref[] getTags(final AnyObjectId commitId) { Collection list = reverseRefMap.get(commitId); Ref[] tags; if (list == null) tags = null; else { tags = list.toArray(new Ref[list.size()]); - // TODO hotfix, this results in a loop and consequently stack overflow - // when opening the history view in EGit - // Arrays.sort(tags, new PlotRefComparator()); + Arrays.sort(tags, new PlotRefComparator()); } return tags; }