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>
This commit is contained in:
parent
d846610035
commit
66ad4237be
|
@ -420,15 +420,22 @@ public void endDocument() throws SAXException {
|
|||
}
|
||||
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…
Reference in New Issue