Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2018-09-05 04:43:50 -0400
committerThomas Wolf2018-09-08 14:15:52 -0400
commit79425b99ba8fe589814d3bee138f167d828f24c9 (patch)
treeb3353f11c15dee6c4b6970e844a802c4f2a6daaf
parent5ca02cf0c2f0cfecc8712672331f088967a662da (diff)
downloadegit-79425b99ba8fe589814d3bee138f167d828f24c9.tar.gz
egit-79425b99ba8fe589814d3bee138f167d828f24c9.tar.xz
egit-79425b99ba8fe589814d3bee138f167d828f24c9.zip
Allow horizontal space in file:// URIishs in GitUrlChecker
Bug: 538322 Change-Id: I8184e9867474934df4a703c1a1b8e7ac7d5aeb85 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java21
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlChecker.java10
2 files changed, 31 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java
index a33fe8c69..cb1258ef5 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/GitCloneWizardTest.java
@@ -174,6 +174,27 @@ public class GitCloneWizardTest extends GitCloneWizardTestBase {
}
@Test
+ public void testFileURIWithSpace() throws Exception {
+ importWizard.openWizard();
+ RepoPropertiesPage propertiesPage = importWizard
+ .openRepoPropertiesPage();
+ propertiesPage.setURI("file:///Some/Directory With Spaces/bare.git");
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ propertiesPage.assertSourceParams(" "
+ + System.getProperty("user.dir")
+ + "\\.\\Some\\Directory With Spaces\\bare.git does not exist.",
+ "", "/Some/Directory With Spaces/bare.git", "file", "",
+ false, "", "", false, false);
+ } else {
+ propertiesPage.assertSourceParams(
+ " /Some/Directory With Spaces/bare.git does not exist.", "",
+ "/Some/Directory With Spaces/bare.git", "file", "", false,
+ "", "", false, false);
+ }
+ bot.button("Cancel").click();
+ }
+
+ @Test
public void canCloneARemoteRepo() throws Exception {
destRepo = new File(ResourcesPlugin.getWorkspace()
.getRoot().getLocation().toFile(), "test1");
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlChecker.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlChecker.java
index 8a9a29089..9f401115b 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlChecker.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlChecker.java
@@ -78,6 +78,16 @@ public abstract class GitUrlChecker {
sanitized = sanitized.substring(GIT_CLONE_COMMAND_PREFIX.length())
.trim();
}
+ // For file URLs, take everything up to the first vertical space
+ try {
+ URIish uri = new URIish(sanitized);
+ if (Protocol.FILE.handles(uri)) {
+ return sanitized.split("\\v", 2)[0]; //$NON-NLS-1$
+ }
+ } catch (URISyntaxException e) {
+ // Ignore here; error will be reported later where this method is
+ // used.
+ }
// Take only the part up to the first whitespace character
return sanitized.split("[\\h|\\v]", 2)[0]; //$NON-NLS-1$
}

Back to the top