Browse Source

Strip trailing /s in repo base URI.

Change-Id: I71040db2cca69638cfad89acdc9179ee80592b27
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
tags/v3.5.0.201409071800-rc1
Yuxuan 'fishy' Wang 10 years ago
parent
commit
73d38bfb33

+ 1
- 1
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java View File

@@ -149,7 +149,7 @@ public class RepoTest extends CLIRepositoryTestCase {
!groupAUri.startsWith(prefix) ||
!groupBUri.startsWith(prefix)) {
start++;
rootUri = defaultUri.substring(0, start);
rootUri = defaultUri.substring(0, start) + "manifest";
defaultUri = defaultUri.substring(start);
notDefaultUri = notDefaultUri.substring(start);
groupAUri = groupAUri.substring(start);

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java View File

@@ -526,7 +526,7 @@ public class RepoCommandTest extends RepositoryTestCase {
!groupAUri.startsWith(prefix) ||
!groupBUri.startsWith(prefix)) {
start++;
rootUri = defaultUri.substring(0, start);
rootUri = defaultUri.substring(0, start) + "manifest";
defaultUri = defaultUri.substring(start);
notDefaultUri = notDefaultUri.substring(start);
groupAUri = groupAUri.substring(start);

+ 7
- 1
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java View File

@@ -289,7 +289,13 @@ public class RepoCommand extends GitCommand<RevCommit> {
this.command = command;
this.inputStream = inputStream;
this.filename = filename;
this.baseUrl = baseUrl;

// Strip trailing /s to match repo behavior.
int lastIndex = baseUrl.length() - 1;
while (lastIndex >= 0 && baseUrl.charAt(lastIndex) == '/')
lastIndex--;
this.baseUrl = baseUrl.substring(0, lastIndex + 1);

remotes = new HashMap<String, String>();
projects = new ArrayList<Project>();
plusGroups = new HashSet<String>();

Loading…
Cancel
Save