From 39001eacc1158050d6f1deaea259b4fe4af136dc Mon Sep 17 00:00:00 2001 From: Yuxuan 'fishy' Wang Date: Thu, 5 Jun 2014 17:25:34 -0700 Subject: [PATCH] Better way to handle relative URLs in manifest XML The old implementation will NOT strip the filename part from the baseUrl, e.g. https://android.googlesource.com/platform/manifest with .. will be resolved to https://android.googlesource.com/platform/, which is actually wrong. This implementation will resolve it to https://android.googlesource.com/ to match the behavior of repo. Change-Id: Ia32c8b34e16eacdf37a0da7025bf0b5cc5f67ed2 Signed-off-by: Yuxuan 'fishy' Wang --- .../src/org/eclipse/jgit/gitrepo/RepoCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 0bcc969388..22ff066fc3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -351,8 +351,8 @@ public class RepoCommand extends GitCommand { } final String remoteUrl; try { - URI uri = new URI(String.format("%s/%s/", baseUrl, remotes.get(defaultRemote))); //$NON-NLS-1$ - remoteUrl = uri.normalize().toString(); + URI uri = new URI(baseUrl); + remoteUrl = uri.resolve(remotes.get(defaultRemote)).toString(); } catch (URISyntaxException e) { throw new SAXException(e); } -- 2.39.5