Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-08-09 11:27:18 +0000
committerThomas Wolf2019-08-09 14:13:09 +0000
commit629c4a6ff266225837ec323051ca56c2af3df7ba (patch)
treee4090307b8412c5ebd3ff90a12a8b7951bc35539 /org.eclipse.egit.ui/src/org/eclipse/egit/ui
parent27f697e7169474370f6e7b24f7e4364a074048cd (diff)
downloadegit-629c4a6ff266225837ec323051ca56c2af3df7ba.tar.gz
egit-629c4a6ff266225837ec323051ca56c2af3df7ba.tar.xz
egit-629c4a6ff266225837ec323051ca56c2af3df7ba.zip
Fix equals & hashCode of StashedCommitNode
Nodes in the repositories view for stashed commits must only be equal if the commit _AND_ the index are equal. Otherwise the TreeViewer in the repositories view gets confused and does not update the tree correctly. Bug: 464949 Change-Id: Iab7dc3e5471f71f4034735bb661e29ed8f3b6998 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/StashedCommitNode.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/StashedCommitNode.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/StashedCommitNode.java
index 463ff357ab..e107c9519c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/StashedCommitNode.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/StashedCommitNode.java
@@ -42,4 +42,15 @@ public class StashedCommitNode extends RepositoryTreeNode<RevCommit> {
public int getIndex() {
return index;
}
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj) && (obj instanceof StashedCommitNode)
+ && index == ((StashedCommitNode) obj).getIndex();
+ }
+
+ @Override
+ public int hashCode() {
+ return Integer.hashCode(index) * 31 + super.hashCode();
+ }
}

Back to the top