summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuxuan 'fishy' Wang <fishywang@google.com>2014-06-09 11:27:52 -0700
committerYuxuan 'fishy' Wang <fishywang@google.com>2014-07-28 16:13:50 -0700
commit73d38bfb331708d18e3a919bfa051bbdd57b646b (patch)
tree5d5c9083d5153e59112cf5b933e8d9d654279542
parent289b7c60a9e232f7b37829c5aad858c7c13286b7 (diff)
downloadjgit-73d38bfb331708d18e3a919bfa051bbdd57b646b.tar.gz
jgit-73d38bfb331708d18e3a919bfa051bbdd57b646b.zip
Strip trailing /s in repo base URI.
Change-Id: I71040db2cca69638cfad89acdc9179ee80592b27 Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java8
3 files changed, 9 insertions, 3 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
index bcb3cb7296..90efae286b 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
@@ -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);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
index 7d645cf935..15a7ef93c4 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
@@ -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);
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 ee814300ae..c47ff0d74f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
@@ -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>();