Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2011-02-06 18:10:30 -0500
committerMatthias Sohn2011-02-06 18:10:30 -0500
commit34e08175090cdd5547369efc91fe64d6fe776671 (patch)
treeba1277527d6295b73d5446f67fca45f64f7fb462
parent9e257ec1172a2925340d926f292b7e6f8890d5e7 (diff)
downloadegit-34e08175090cdd5547369efc91fe64d6fe776671.tar.gz
egit-34e08175090cdd5547369efc91fe64d6fe776671.tar.xz
egit-34e08175090cdd5547369efc91fe64d6fe776671.zip
Fix IncorrectObjectTypeException in CommitMessageViewer
Tags can point to any object, the commit message viewer only wants those referring to commits. Bug: 336380 Change-Id: I329b0a0254a3b5585798f187de60758615011ead Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
index ab234b61b..8730a6b06 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitMessageViewer.java
@@ -55,6 +55,7 @@ import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revplot.PlotCommit;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.osgi.util.NLS;
@@ -646,8 +647,12 @@ class CommitMessageViewer extends TextViewer implements
// both RevCommits must be allocated using same RevWalk instance,
// otherwise isMergedInto returns wrong result!
RevCommit current = revWalk.parseCommit(commit);
- RevCommit newTag = revWalk.parseCommit(tagsMap.get(tagName).getObjectId());
-
+ Ref ref = tagsMap.get(tagName);
+ // tags can point to any object, we only want tags pointing at commits
+ RevObject any = revWalk.peel(revWalk.parseAny(ref.getObjectId()));
+ if (!(any instanceof RevCommit))
+ continue;
+ RevCommit newTag = (RevCommit) any;
if (newTag.getId().equals(commit))
continue;
@@ -658,9 +663,9 @@ class CommitMessageViewer extends TextViewer implements
// both oldTag and newTag satisfy search criteria, so taking the closest one
if (isMergedInto(revWalk, oldTag, newTag, searchDescendant))
- tagRef = tagsMap.get(tagName);
+ tagRef = ref;
} else
- tagRef = tagsMap.get(tagName);
+ tagRef = ref;
}
}

Back to the top