diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2014-06-10 15:49:29 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2014-06-10 15:49:29 -0400 |
commit | 83846d1f6dbec7d60a23812dc92805a3bd298479 (patch) | |
tree | 3d95fc0e592f48970789c355a16eed7dc3af55c7 /org.eclipse.jgit/src | |
parent | 79004dd42a89cb808e11da816749f081a6993aaf (diff) | |
parent | f4943de29b486f7a066b570457722220530523b6 (diff) | |
download | jgit-83846d1f6dbec7d60a23812dc92805a3bd298479.tar.gz jgit-83846d1f6dbec7d60a23812dc92805a3bd298479.zip |
Merge "Fixed the problem with calling LsRemoteCommand without a local repository over the ssh and git:// protocols."
Diffstat (limited to 'org.eclipse.jgit/src')
4 files changed, 50 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java index 16d57fa9c4..6f17ebf094 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java @@ -50,6 +50,7 @@ package org.eclipse.jgit.transport; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.util.FS; /** * The base class for transports that use SSH protocol. This class allows @@ -81,6 +82,18 @@ public abstract class SshTransport extends TcpTransport { } /** + * Create a new transport instance without a local repository. + * + * @param uri the URI used to access the remote repository. This must be the + * URI passed to {@link #open(URIish)}. + * @since 3.5 + */ + protected SshTransport(URIish uri) { + super(uri); + sch = SshSessionFactory.getInstance(); + } + + /** * Set SSH session factory instead of the default one for this instance of * the transport. * @@ -118,8 +131,10 @@ public abstract class SshTransport extends TcpTransport { final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; + final FS fs = local == null ? FS.detect() : local.getFS(); + sock = sch - .getSession(uri, getCredentialsProvider(), local.getFS(), tms); + .getSession(uri, getCredentialsProvider(), fs, tms); return sock; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TcpTransport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TcpTransport.java index a6e5390890..fcf026cc6e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TcpTransport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TcpTransport.java @@ -66,4 +66,15 @@ public abstract class TcpTransport extends Transport { protected TcpTransport(Repository local, URIish uri) { super(local, uri); } + + /** + * Create a new transport instance without a local repository. + * + * @param uri the URI used to access the remote repository. This must be the + * URI passed to {@link #open(URIish)}. + * @since 3.5 + */ + protected TcpTransport(URIish uri) { + super(uri); + } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java index 4fca19ce80..a7f42fd873 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java @@ -100,12 +100,21 @@ class TransportGitAnon extends TcpTransport implements PackTransport { throws NotSupportedException { return new TransportGitAnon(local, uri); } + + @Override + public Transport open(URIish uri) throws NotSupportedException, TransportException { + return new TransportGitAnon(uri); + } }; TransportGitAnon(final Repository local, final URIish uri) { super(local, uri); } + TransportGitAnon(final URIish uri) { + super(uri); + } + @Override public FetchConnection openFetch() throws TransportException { return new TcpFetchConnection(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java index dde4d20585..b27fa0d6b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java @@ -126,10 +126,24 @@ public class TransportGitSsh extends SshTransport implements PackTransport { throws NotSupportedException { return new TransportGitSsh(local, uri); } + + @Override + public Transport open(URIish uri) throws NotSupportedException, TransportException { + return new TransportGitSsh(uri); + } }; TransportGitSsh(final Repository local, final URIish uri) { super(local, uri); + initSshSessionFactory(); + } + + TransportGitSsh(final URIish uri) { + super(uri); + initSshSessionFactory(); + } + + private void initSshSessionFactory() { if (useExtSession()) { setSshSessionFactory(new SshSessionFactory() { @Override |