From beee7b86afd5d4e1e9185c1f81640b83d74398f3 Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Fri, 27 Jul 2012 11:53:51 +0200 Subject: Fix resolving of relative file URIs in TransportLocal A configured remote url like "../repo" works with C Git. In JGit, it only worked if Java's current working directory happened to be the local repository working directory. Change-Id: I33ba3f81b37d03cf17ca7ae25a90774a27e7e02b Signed-off-by: Robin Stocker --- .../tst/org/eclipse/jgit/transport/TransportTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java index 9899d14d8d..4e7b5e420e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java @@ -58,6 +58,7 @@ import java.util.List; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; +import org.eclipse.jgit.storage.file.FileRepository; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -213,6 +214,18 @@ public class TransportTest extends SampleDataRepositoryTestCase { assertEquals(ObjectId.zeroId(), tru.getOldObjectId()); } + @Test + public void testLocalTransportWithRelativePath() throws Exception { + FileRepository other = createWorkRepository(); + String otherDir = other.getWorkTree().getName(); + + RemoteConfig config = new RemoteConfig(db.getConfig(), "other"); + config.addURI(new URIish("../" + otherDir)); + + // Should not throw NoRemoteRepositoryException + transport = Transport.open(db, config); + } + @Test public void testSpi() { List protocols = Transport.getTransportProtocols(); -- cgit v1.2.3