aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkirmantas Kligys2009-12-29 14:57:55 -0500
committerRobin Rosenberg2009-12-29 18:53:00 -0500
commit9db8b9b656abb444445adfa0217a0fe2788d8d10 (patch)
tree3a5a2d8cf99467a5f8f8d422eeab0c8168845f07
parent2c13813e93ca6f091f801b03c451943766f05c86 (diff)
downloadegit-9db8b9b656abb444445adfa0217a0fe2788d8d10.zip
egit-9db8b9b656abb444445adfa0217a0fe2788d8d10.tar.gz
egit-9db8b9b656abb444445adfa0217a0fe2788d8d10.tar.xz
Quick diff against git head used to fail if the project itself has no mapping.
Resources inside the project can have mappings even if the project does not. Now get repository mappings for a single resource to be diffed and not the whole project. Change-Id: Ifa4d7b4a632ff4befade45deb8ec3242a425931e Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitDocument.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitDocument.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitDocument.java
index 942c045..7bd11db 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitDocument.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitDocument.java
@@ -13,7 +13,6 @@ import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.egit.core.GitProvider;
@@ -73,8 +72,7 @@ class GitDocument extends Document implements RepositoryListener {
void populate() throws IOException {
Activator.trace("(GitDocument) populate: " + resource); //$NON-NLS-1$
- final IProject project = resource.getProject();
- RepositoryMapping mapping = RepositoryMapping.getMapping(project);
+ RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
if (mapping == null) {
setResolved(null, null, null, ""); //$NON-NLS-1$
return;
@@ -171,11 +169,8 @@ class GitDocument extends Document implements RepositoryListener {
}
private Repository getRepository() {
- IProject project = resource.getProject();
- RepositoryMapping mapping = RepositoryMapping.getMapping(project);
- if (mapping != null)
- return mapping.getRepository();
- return null;
+ RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
+ return (mapping != null) ? mapping.getRepository() : null;
}
/**