Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-02-05 06:45:25 +0000
committerMatthias Sohn2016-02-19 23:31:44 +0000
commit6ee2f439c43c52ff4a8f79bf3f2e4977bc41d5e2 (patch)
tree6a63be42f99325369d8865132938c0f0d0a17ffc /org.eclipse.egit.core.test
parent5caf0e4f01820c0c96c8872c204938d1b29dbc73 (diff)
downloadegit-6ee2f439c43c52ff4a8f79bf3f2e4977bc41d5e2.tar.gz
egit-6ee2f439c43c52ff4a8f79bf3f2e4977bc41d5e2.tar.xz
egit-6ee2f439c43c52ff4a8f79bf3f2e4977bc41d5e2.zip
Handle relative paths in RepositoryMapping creator
file.getAbsolutePath() with a relative path here resolves against the current working directory of the Eclipse instance. The path is, however, relative to the IContainer being mapped! This causes many of the various occurrences of errors in the log about gone repository mappings, especially those where the absolute path is nowhere near any expected directory. Bug: 456799 Bug: 476011 Change-Id: I9eebf4cb81b7584936f823885db8a5d9340035fd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.core.test')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/project/RepositoryMappingTest.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/project/RepositoryMappingTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/project/RepositoryMappingTest.java
index 326244821b..ccc158573c 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/project/RepositoryMappingTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/project/RepositoryMappingTest.java
@@ -13,6 +13,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import java.io.File;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -107,6 +109,15 @@ public class RepositoryMappingTest extends GitTestCase {
assertEquals(repository, mapping.getRepository());
}
+ @Test
+ public void shouldResolveRelativePathRelativeToContainer() {
+ IPath projectPath = project.getProject().getLocation();
+ RepositoryMapping mapping = RepositoryMapping
+ .create(project.getProject(), new File(".git"));
+ assertEquals(projectPath.append(".git"),
+ mapping.getGitDirAbsolutePath());
+ }
+
private IPath getWorkTreePath() {
return new Path(repository.getWorkTree().getAbsolutePath());
}

Back to the top