Skip to content
Permalink
Browse files
648: git sync requires ssh to be specified when setting 'to' repo o…
…n set-up

Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Sep 17, 2020
1 parent d7cdb98 commit 44ceeb74cb859ab2858c15769490325dfe39cc92
Showing with 7 additions and 3 deletions.
  1. +2 −2 cli/src/main/java/org/openjdk/skara/cli/GitSync.java
  2. +5 −1 cli/src/main/java/org/openjdk/skara/cli/Remote.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")) {
@@ -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;
}
}

1 comment on commit 44ceeb7

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 44ceeb7 Sep 17, 2020

Please sign in to comment.