diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java index e62aee3adca0..18402c891c77 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java @@ -170,7 +170,7 @@ public class GithubRebaseAction extends DumbAwareAction { return null; } - final String parentRepoUrl = GithubUrlUtil.getGitHost() + '/' + repositoryInfo.getParent().getFullName() + ".git"; + final String parentRepoUrl = GithubUrlUtil.getCloneUrl(repositoryInfo.getParent().getFullPath()); LOG.info("Adding GitHub parent as a remote host"); indicator.setText("Adding GitHub parent as a remote host..."); diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java index 0b22377a1a1e..c3607aadedb9 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java @@ -172,7 +172,7 @@ public class GithubShareAction extends DumbAwareAction { return; } - final String remoteUrl = GithubUrlUtil.getGitHost() + "/" + githubInfo.getUser().getLogin() + "/" + name + ".git"; + final String remoteUrl = GithubUrlUtil.getCloneUrl(githubInfo.getUser().getLogin(), name); final String remoteName = finalExternalRemoteDetected ? "github" : "origin"; //git remote add origin git@github.com:login/name.git diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserAction.java index 607d9d90b407..70bc45037e47 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserAction.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserAction.java @@ -49,7 +49,7 @@ abstract class GithubShowCommitInBrowserAction extends DumbAwareAction { return; } - String githubUrl = GithubUrlUtil.getGitHost() + '/' + userAndRepository.getUser() + '/' + String githubUrl = GithubUrlUtil.getGithubHost() + '/' + userAndRepository.getUser() + '/' + userAndRepository.getRepository() + "/commit/" + revisionHash; BrowserUtil.launchBrowser(githubUrl); } diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java index 1b30da78843c..c208e4db0ec1 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java +++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java @@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.github.api.GithubApiUtil; import org.jetbrains.plugins.github.api.GithubFullPath; -import org.jetbrains.plugins.github.util.GithubSettings; /** * @author Aleksey Pivovarov @@ -62,13 +61,13 @@ public class GithubUrlUtil { } /** - * Returns the "host" part of Git URLs. + * Returns the "host" part of Github URLs. * E.g.: https://github.com * https://my.company.url * Note: there is no trailing slash in the returned url. */ @NotNull - public static String getGitHost() { + public static String getGithubHost() { return "https://" + getGitHostWithoutProtocol(); } @@ -153,7 +152,7 @@ public class GithubUrlUtil { */ @Nullable public static String makeGithubRepoUrlFromRemoteUrl(@NotNull String remoteUrl) { - return makeGithubRepoUrlFromRemoteUrl(remoteUrl, getGitHost()); + return makeGithubRepoUrlFromRemoteUrl(remoteUrl, getGithubHost()); } @Nullable @@ -177,6 +176,11 @@ public class GithubUrlUtil { @NotNull public static String getCloneUrl(@NotNull GithubFullPath path) { - return getGitHost() + "/" + path.getUser() + "/" + path.getRepository() + ".git"; + return getCloneUrl(path.getUser(), path.getRepository()); + } + + @NotNull + public static String getCloneUrl(@NotNull String user, @NotNull String repo) { + return getGithubHost() + "/" + user + "/" + repo + ".git"; } }