diff options
author | Yuxuan 'fishy' Wang <fishywang@google.com> | 2014-08-13 10:36:56 -0700 |
---|---|---|
committer | Yuxuan 'fishy' Wang <fishywang@google.com> | 2014-08-13 10:36:56 -0700 |
commit | 38a24bc7990bfa76e5dbd905434341a28e8e543f (patch) | |
tree | a3574fc47d8a2984fc88f9d70977da97f47bb167 /org.eclipse.jgit | |
parent | 63eb9042a4b7e71c4ff0bbea7005cf453c2b9df9 (diff) | |
download | jgit-38a24bc7990bfa76e5dbd905434341a28e8e543f.tar.gz jgit-38a24bc7990bfa76e5dbd905434341a28e8e543f.zip |
Tweak the handling of remote url in jgit repo.
This kind of reverted 31148. URI.resolve actually can handle the absolute URL
well, the problem is only the missing "/".
Change-Id: Iee5866c005cbc1430dc20ee7db321b8b51afed30
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index d8e4c1f9ee..57514a203d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -418,24 +418,19 @@ public class RepoCommand extends GitCommand<RevCommit> { else throw new SAXException(RepoText.get().errorNoDefault); } - final String remoteUrl; + String remoteUrl; try { - URI uri = new URI(remotes.get(defaultRemote)); - if (uri.getHost() != null) { - // This is not relative path, no need for baseUrl. - remoteUrl = uri.toString(); - } else { - uri = new URI(baseUrl); - remoteUrl = uri.resolve( - remotes.get(defaultRemote)).toString(); - } + URI uri = new URI(baseUrl); + remoteUrl = uri.resolve(remotes.get(defaultRemote)).toString(); + if (!remoteUrl.endsWith("/")) + remoteUrl = remoteUrl + "/"; } catch (URISyntaxException e) { throw new SAXException(e); } removeNotInGroup(); removeOverlaps(); for (Project proj : projects) { - command.addSubmodule(remoteUrl + "/" + proj.name, + command.addSubmodule(remoteUrl + proj.name, proj.path, proj.revision == null ? defaultRevision : proj.revision, |