From a528c0f185ace73dd32c6e3f77d033893af46335 Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Thu, 17 Sep 2020 09:48:39 +0200 Subject: [PATCH] 648 --- cli/src/main/java/org/openjdk/skara/cli/GitSync.java | 4 ++-- cli/src/main/java/org/openjdk/skara/cli/Remote.java | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cli/src/main/java/org/openjdk/skara/cli/GitSync.java b/cli/src/main/java/org/openjdk/skara/cli/GitSync.java index debededf1..c5d37b99a 100644 --- a/cli/src/main/java/org/openjdk/skara/cli/GitSync.java +++ b/cli/src/main/java/org/openjdk/skara/cli/GitSync.java @@ -170,7 +170,7 @@ static void sync(Repository repo, String[] args) throws IOException, Interrupted } var fromPullPath = remotes.contains(from) ? - Remote.toURI(repo.pullPath(from)) : URI.create(from); + Remote.toURI(repo.pullPath(from)) : Remote.toURI(from); String to = null; if (arguments.contains("to")) { @@ -193,7 +193,7 @@ static void sync(Repository repo, String[] args) throws IOException, Interrupted } var toPushPath = remotes.contains(to) ? - Remote.toURI(repo.pullPath(to)) : URI.create(to); + Remote.toURI(repo.pullPath(to)) : Remote.toURI(to); var toScheme = toPushPath.getScheme(); if (toScheme.equals("https") || toScheme.equals("http")) { diff --git a/cli/src/main/java/org/openjdk/skara/cli/Remote.java b/cli/src/main/java/org/openjdk/skara/cli/Remote.java index 18c2ebb04..0a39cd99c 100644 --- a/cli/src/main/java/org/openjdk/skara/cli/Remote.java +++ b/cli/src/main/java/org/openjdk/skara/cli/Remote.java @@ -85,6 +85,10 @@ public static URI toWebURI(String remotePath) throws IOException { } public static URI toURI(String remotePath) throws IOException { + return toURI(remotePath, false); + } + + public static URI toURI(String remotePath, boolean canonicalize) throws IOException { if (remotePath.startsWith("git+")) { remotePath = remotePath.substring("git+".length()); } @@ -101,7 +105,7 @@ public static URI toURI(String remotePath) throws IOException { if (indexOfColon != -1) { if (indexOfSlash == -1 || indexOfColon < indexOfSlash) { var uri = URI.create("ssh://" + remotePath.replace(":", "/")); - return sshCanonicalize(uri); + return canonicalize ? sshCanonicalize(uri) : uri; } }