Fixed the problem with calling LsRemoteCommand without a local repository over the ssh and git:// protocols.
Bug: 436695 Change-Id: Ifd69fbc04156fa4dacdcba6225768f43843eee97 Signed-off-by: Anton Bannykh <anton.bannykh@gmail.com> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
This commit is contained in:
parent
64b0531c35
commit
f4943de29b
|
@ -50,6 +50,7 @@
|
||||||
import org.eclipse.jgit.errors.TransportException;
|
import org.eclipse.jgit.errors.TransportException;
|
||||||
import org.eclipse.jgit.internal.JGitText;
|
import org.eclipse.jgit.internal.JGitText;
|
||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
import org.eclipse.jgit.util.FS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class for transports that use SSH protocol. This class allows
|
* The base class for transports that use SSH protocol. This class allows
|
||||||
|
@ -80,6 +81,18 @@ protected SshTransport(Repository local, URIish uri) {
|
||||||
sch = SshSessionFactory.getInstance();
|
sch = SshSessionFactory.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Set SSH session factory instead of the default one for this instance of
|
||||||
* the transport.
|
* the transport.
|
||||||
|
@ -118,8 +131,10 @@ protected RemoteSession getSession() throws TransportException {
|
||||||
|
|
||||||
final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0;
|
final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0;
|
||||||
|
|
||||||
|
final FS fs = local == null ? FS.detect() : local.getFS();
|
||||||
|
|
||||||
sock = sch
|
sock = sch
|
||||||
.getSession(uri, getCredentialsProvider(), local.getFS(), tms);
|
.getSession(uri, getCredentialsProvider(), fs, tms);
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,4 +66,15 @@ public abstract class TcpTransport extends Transport {
|
||||||
protected TcpTransport(Repository local, URIish uri) {
|
protected TcpTransport(Repository local, URIish uri) {
|
||||||
super(local, 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,21 @@ public Transport open(URIish uri, Repository local, String remoteName)
|
||||||
throws NotSupportedException {
|
throws NotSupportedException {
|
||||||
return new TransportGitAnon(local, uri);
|
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) {
|
TransportGitAnon(final Repository local, final URIish uri) {
|
||||||
super(local, uri);
|
super(local, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransportGitAnon(final URIish uri) {
|
||||||
|
super(uri);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FetchConnection openFetch() throws TransportException {
|
public FetchConnection openFetch() throws TransportException {
|
||||||
return new TcpFetchConnection();
|
return new TcpFetchConnection();
|
||||||
|
|
|
@ -126,10 +126,24 @@ public Transport open(URIish uri, Repository local, String remoteName)
|
||||||
throws NotSupportedException {
|
throws NotSupportedException {
|
||||||
return new TransportGitSsh(local, uri);
|
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) {
|
TransportGitSsh(final Repository local, final URIish uri) {
|
||||||
super(local, uri);
|
super(local, uri);
|
||||||
|
initSshSessionFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
TransportGitSsh(final URIish uri) {
|
||||||
|
super(uri);
|
||||||
|
initSshSessionFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSshSessionFactory() {
|
||||||
if (useExtSession()) {
|
if (useExtSession()) {
|
||||||
setSshSessionFactory(new SshSessionFactory() {
|
setSshSessionFactory(new SshSessionFactory() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue