Browse Source

Merge "Tweak the handling of remote url in jgit repo."

stable-3.5
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
b1bea54113
  1. 17
      org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

17
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

@ -418,24 +418,19 @@ public class RepoCommand extends GitCommand<RevCommit> {
else else
throw new SAXException(RepoText.get().errorNoDefault); throw new SAXException(RepoText.get().errorNoDefault);
} }
final String remoteUrl; String remoteUrl;
try { try {
URI uri = new URI(remotes.get(defaultRemote)); URI uri = new URI(baseUrl);
if (uri.getHost() != null) { remoteUrl = uri.resolve(remotes.get(defaultRemote)).toString();
// This is not relative path, no need for baseUrl. if (!remoteUrl.endsWith("/"))
remoteUrl = uri.toString(); remoteUrl = remoteUrl + "/";
} else {
uri = new URI(baseUrl);
remoteUrl = uri.resolve(
remotes.get(defaultRemote)).toString();
}
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
throw new SAXException(e); throw new SAXException(e);
} }
removeNotInGroup(); removeNotInGroup();
removeOverlaps(); removeOverlaps();
for (Project proj : projects) { for (Project proj : projects) {
command.addSubmodule(remoteUrl + "/" + proj.name, command.addSubmodule(remoteUrl + proj.name,
proj.path, proj.path,
proj.revision == null proj.revision == null
? defaultRevision : proj.revision, ? defaultRevision : proj.revision,

Loading…
Cancel
Save