Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Wagenknecht2015-02-24 16:25:54 +0000
committerGunnar Wagenknecht2015-03-03 11:13:12 +0000
commitb0489b7342659e22cd7683ec6a696891fc5f8474 (patch)
treeb074a869808298d33104e269d59d777fb0940d55 /org.eclipse.egit.core.test/src
parent37ee66c68e352dd49d338d520b8e7cad1f7f9dc8 (diff)
downloadegit-b0489b7342659e22cd7683ec6a696891fc5f8474.tar.gz
egit-b0489b7342659e22cd7683ec6a696891fc5f8474.tar.xz
egit-b0489b7342659e22cd7683ec6a696891fc5f8474.zip
Fix behavior of EGit when repo is a symlink
The use of getCanonicalPath is problematic on POSIX file systems. If the repo is a symlink (or one folder of the repo path) then this will be resolved to the real file system location. There are multiple issues with that. Most notably is the fact that Eclipse resource locations will not use the canonical path but an absolute path. This translates into a couple of weird issue with RepositoryMapping and resolving paths. This change removes every occurence of getCanonicalPath() calls, which should also be line with what JGit does. Bug: 460118 Change-Id: I884eded8b24c2de14f0255d2371d016b4e435c28 Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Diffstat (limited to 'org.eclipse.egit.core.test/src')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java
index 9c7e3bb083..7be77c529b 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestRepository.java
@@ -78,11 +78,7 @@ public class TestRepository {
tmpRepository.close();
// use repository instance from RepositoryCache!
repository = Activator.getDefault().getRepositoryCache().lookupRepository(gitDir);
- try {
- workdirPrefix = repository.getWorkTree().getCanonicalPath();
- } catch (IOException err) {
- workdirPrefix = repository.getWorkTree().getAbsolutePath();
- }
+ workdirPrefix = repository.getWorkTree().getAbsolutePath();
workdirPrefix = workdirPrefix.replace('\\', '/');
if (!workdirPrefix.endsWith("/")) //$NON-NLS-1$
workdirPrefix += "/"; //$NON-NLS-1$
@@ -96,11 +92,7 @@ public class TestRepository {
*/
public TestRepository(Repository repository) throws IOException {
this.repository = repository;
- try {
- workdirPrefix = repository.getWorkTree().getCanonicalPath();
- } catch (IOException err) {
- workdirPrefix = repository.getWorkTree().getAbsolutePath();
- }
+ workdirPrefix = repository.getWorkTree().getAbsolutePath();
workdirPrefix = workdirPrefix.replace('\\', '/');
if (!workdirPrefix.endsWith("/")) //$NON-NLS-1$
workdirPrefix += "/"; //$NON-NLS-1$

Back to the top