aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
authorKevin Sawicki <kevin@github.com>2012-03-01 17:37:41 -0800
committerChris Aniszczyk <zx@twitter.com>2012-03-05 20:46:26 -0800
commit9908c203a5fc8bb59e6b539d94c558a516247161 (patch)
treed05133afe33c3c121598719bc294d76418c5f494 /org.eclipse.jgit.test/tst/org/eclipse/jgit
parentdb29665e64f508eefa12ba8c3c692312f4c9a73e (diff)
downloadjgit-9908c203a5fc8bb59e6b539d94c558a516247161.tar.gz
jgit-9908c203a5fc8bb59e6b539d94c558a516247161.zip
Support insteadOf and pushInsteadOf URL replacement
Bug: 346873 Change-Id: I4116328f93f411da56a633bc32fd064b2ac083f2 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RemoteConfigTest.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RemoteConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RemoteConfigTest.java
index 03a6c019ed..0cada5c7ee 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RemoteConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RemoteConfigTest.java
@@ -50,6 +50,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.jgit.errors.ConfigInvalidException;
@@ -455,4 +456,66 @@ public class RemoteConfigTest {
+ "\tfetch = +refs/heads/*:refs/remotes/origin/*\n"
+ "\ttimeout = 60\n");
}
+
+ @Test
+ public void noInsteadOf() throws Exception {
+ config.setString("remote", "origin", "url", "short:project.git");
+ config.setString("url", "https://server/repos/", "name", "short:");
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertFalse(rc.getURIs().isEmpty());
+ assertEquals("short:project.git", rc.getURIs().get(0).toASCIIString());
+ }
+
+ @Test
+ public void singleInsteadOf() throws Exception {
+ config.setString("remote", "origin", "url", "short:project.git");
+ config.setString("url", "https://server/repos/", "insteadOf", "short:");
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertFalse(rc.getURIs().isEmpty());
+ assertEquals("https://server/repos/project.git", rc.getURIs().get(0)
+ .toASCIIString());
+ }
+
+ @Test
+ public void multipleInsteadOf() throws Exception {
+ config.setString("remote", "origin", "url", "prefixproject.git");
+ config.setStringList("url", "https://server/repos/", "insteadOf",
+ Arrays.asList("pre", "prefix", "pref", "perf"));
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertFalse(rc.getURIs().isEmpty());
+ assertEquals("https://server/repos/project.git", rc.getURIs().get(0)
+ .toASCIIString());
+ }
+
+ @Test
+ public void noPushInsteadOf() throws Exception {
+ config.setString("remote", "origin", "pushurl", "short:project.git");
+ config.setString("url", "https://server/repos/", "name", "short:");
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertFalse(rc.getPushURIs().isEmpty());
+ assertEquals("short:project.git", rc.getPushURIs().get(0)
+ .toASCIIString());
+ }
+
+ @Test
+ public void singlePushInsteadOf() throws Exception {
+ config.setString("remote", "origin", "pushurl", "short:project.git");
+ config.setString("url", "https://server/repos/", "pushInsteadOf",
+ "short:");
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertFalse(rc.getPushURIs().isEmpty());
+ assertEquals("https://server/repos/project.git", rc.getPushURIs()
+ .get(0).toASCIIString());
+ }
+
+ @Test
+ public void multiplePushInsteadOf() throws Exception {
+ config.setString("remote", "origin", "pushurl", "prefixproject.git");
+ config.setStringList("url", "https://server/repos/", "pushInsteadOf",
+ Arrays.asList("pre", "prefix", "pref", "perf"));
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertFalse(rc.getPushURIs().isEmpty());
+ assertEquals("https://server/repos/project.git", rc.getPushURIs()
+ .get(0).toASCIIString());
+ }
}