diff --git a/plugins/git4idea/src/git4idea/GitBranch.java b/plugins/git4idea/src/git4idea/GitBranch.java index edced4d22efc..fd12fc936e9e 100644 --- a/plugins/git4idea/src/git4idea/GitBranch.java +++ b/plugins/git4idea/src/git4idea/GitBranch.java @@ -109,9 +109,9 @@ public class GitBranch extends GitReference { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (!super.equals(o)) { + return false; + } // Reusing equals from super: only the name is important: // branches are considered equal even if they point to different commits. diff --git a/plugins/git4idea/src/git4idea/GitReference.java b/plugins/git4idea/src/git4idea/GitReference.java index f54c22e51c72..ef2c9a8a0c5e 100644 --- a/plugins/git4idea/src/git4idea/GitReference.java +++ b/plugins/git4idea/src/git4idea/GitReference.java @@ -50,6 +50,10 @@ public abstract class GitReference implements Comparable { @Override public boolean equals(Object obj) { + if (this == obj) { + return true; + } + return obj instanceof GitReference && getFullName().equals(((GitReference)obj).getFullName()); }