diff options
authorBrad Davis2012-02-27 17:54:26 -0500
committerMatthias Sohn2012-02-27 17:54:26 -0500
commit8cd38faca85662d839f72cf8c460d87020ee34a7 (patch)
parent3005ff535c69c722396b6d2945681b97f5539340 (diff)
Fix the behavior of the Share|Git... dialog when a repo is a symlink
The RepositoryFinder.register(IContainer, File) method is capable of registering a repository with a path that is not relative to the containing project, because of the nature of File.getCanonicalFile(). For instance, if you are working in /dev/workspace/project and that path contains a .git symlink which points to /dev/repo/project.git, then the registered path for that repository will be the latter. However, code in RepositoringMapping.getGitDirAbsolutePath() and ExistingOrNewPage.fillTreeItemWithGitDirectory() make assumptions about it being relative to the containing project. This only occurs on Posix platforms because File.getCanonicalFile() does not have the same behavior on Windows. Specifically it doesn't recognize junctions (the Windows equivalent to symbolic links) and therefore does not try to resolve them. This patch addresses the problem by removing the use of File.getCanonicalFile() and replacing it with File.getAbsoluteFile() which is already there as a fallback if File.getCanonicalFile() throws an exception. This will make the behavior of sharing a project the same on both Windows and Posix platforms. Bug: 338989 Change-Id: I6901f386b00e8cd5208f22aa93298bca4d750dd3 Signed-off-by: Bradley Austin Davis <bradd@amazon.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
1 files changed, 1 insertions, 7 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java
index 71a75ce..6caae3d 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java
@@ -11,7 +11,6 @@
package org.eclipse.egit.core.project;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -160,12 +159,7 @@ public class RepositoryFinder {
private void register(final IContainer c, final File gitdir) {
- File f;
- try {
- f = gitdir.getCanonicalFile();
- } catch (IOException ioe) {
- f = gitdir.getAbsoluteFile();
- }
+ File f = gitdir.getAbsoluteFile();
if (gitdirs.contains(f))