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>
stable-3.5
Yuxuan 'fishy' Wang 10 years ago
parent
commit
66ad4237be
  1. 13
      org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

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

@ -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