bug 383026: Versions model classes should implement equals/hashcode
eagerly determine the url, as equals and hashcode
do not access the getter, the url property is not
correctly initialized.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=383026
Change-Id: Idb8577e26eb68d9a99cd67d92c03cef1f7fedcc7
diff --git a/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitRepository.java b/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitRepository.java
index c279743..0e8557b 100644
--- a/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitRepository.java
+++ b/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitRepository.java
@@ -28,6 +28,7 @@
public GitRepository(GitConnector connector, RepositoryMapping mapping) {
this.mapping = mapping;
setConnector(connector);
+ determineUrl();
}
public Repository getRepository() {
@@ -38,18 +39,6 @@
return mapping;
}
- @Override
- public String getUrl() {
- // FIXME - use a better approach and handle multiple remotes better
- String originUrl = getRepository().getConfig().getString("remote", "origin", "url"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- if (originUrl != null) {
- return originUrl;
- }
-
- return super.getUrl();
- }
-
public String getWorkspaceRevision(IResource resource) {
// TODO Auto-generated method stub
return null;
@@ -59,4 +48,12 @@
return mapping.getRepoRelativePath(resource);
}
+ private void determineUrl() {
+ // FIXME - use a better approach and handle multiple remotes better
+ String originUrl = getRepository().getConfig().getString("remote", "origin", "url"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ if (originUrl != null) {
+ this.setUrl(originUrl);
+ }
+ }
}