summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/models/RefModel.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/wicket/models/RefModel.java')
-rw-r--r--src/com/gitblit/wicket/models/RefModel.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/com/gitblit/wicket/models/RefModel.java b/src/com/gitblit/wicket/models/RefModel.java
index ab445931..e0831f5a 100644
--- a/src/com/gitblit/wicket/models/RefModel.java
+++ b/src/com/gitblit/wicket/models/RefModel.java
@@ -27,9 +27,9 @@ import com.gitblit.utils.JGitUtils;
public class RefModel implements Serializable, Comparable<RefModel> {
private static final long serialVersionUID = 1L;
- final String displayName;
- transient Ref ref;
- final RevCommit commit;
+ public final String displayName;
+ public final RevCommit commit;
+ public transient Ref ref;
public RefModel(String displayName, Ref ref, RevCommit commit) {
this.displayName = displayName;
@@ -41,18 +41,10 @@ public class RefModel implements Serializable, Comparable<RefModel> {
return JGitUtils.getCommitDate(commit);
}
- public String getDisplayName() {
- return displayName;
- }
-
public String getName() {
return ref.getName();
}
- public RevCommit getCommit() {
- return commit;
- }
-
public ObjectId getCommitId() {
return commit.getId();
}
@@ -71,6 +63,20 @@ public class RefModel implements Serializable, Comparable<RefModel> {
}
@Override
+ public int hashCode() {
+ return getCommitId().hashCode() + getName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof RefModel) {
+ RefModel other = (RefModel) o;
+ return getName().equals(other.getName());
+ }
+ return super.equals(o);
+ }
+
+ @Override
public int compareTo(RefModel o) {
return getDate().compareTo(o.getDate());
}