Browse Source

Fix non-relative remote defined in manifest xml.

Currently if the remote defined in repo manifest xml is non-relative (e.g.
"https://chromium.googlesource.com"), our code will break. This change fixed
that.

It also makes that remotes are ending with "/".

Change-Id: Icef46360b32227a9db1d9bb9e6d929c72aeaa8df
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
tags/v3.5.0.201409071800-rc1
Yuxuan 'fishy' Wang 9 years ago
parent
commit
66ad4237be
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

+ 10
- 3
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java View File

@@ -420,15 +420,22 @@ public class RepoCommand extends GitCommand<RevCommit> {
}
final String remoteUrl;
try {
URI uri = new URI(baseUrl);
remoteUrl = uri.resolve(remotes.get(defaultRemote)).toString();
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();
}
} 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,

Loading…
Cancel
Save