From b0489b7342659e22cd7683ec6a696891fc5f8474 Mon Sep 17 00:00:00 2001 From: Gunnar Wagenknecht Date: Tue, 24 Feb 2015 17:25:54 +0100 Subject: 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 --- .../src/org/eclipse/egit/core/test/TestRepository.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'org.eclipse.egit.core.test/src') 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$ -- cgit v1.2.3