]> source.dussan.org Git - jgit.git/commitdiff
Strip trailing /s in repo base URI. 16/28216/7
authorYuxuan 'fishy' Wang <fishywang@google.com>
Mon, 9 Jun 2014 18:27:52 +0000 (11:27 -0700)
committerYuxuan 'fishy' Wang <fishywang@google.com>
Mon, 28 Jul 2014 23:13:50 +0000 (16:13 -0700)
Change-Id: I71040db2cca69638cfad89acdc9179ee80592b27
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RepoTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java

index bcb3cb7296b24588a75e71269acc3e48c2ee0c33..90efae286b7fbf2f0cb0da96ecc7bae6f712caa3 100644 (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);
index 7d645cf93528748b5fbbd0307a95cb6cb6ad2ff8..15a7ef93c4289738195c9d6524295e36541cc144 100644 (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);
index ee814300ae3c3290b04495b80f629502acab0fe4..c47ff0d74f5fa87033f21805b9952e2454e6739d 100644 (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>();