Top Description Inners Fields Constructors Methods
org.eclipse.jgit.transport

pack-priv Class TransportLocal

extends Transport
implements PackTransport
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.PackTransport
Imports
java.io.BufferedInputStream, .BufferedOutputStream, .File, .IOException, .InputStream, .OutputStream, java.util.Collection, .Collections, .Map, .Set, org.eclipse.jgit.errors.NoRemoteRepositoryException, .NotSupportedException, .TransportException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Repository, .RepositoryBuilder, .RepositoryCache, org.eclipse.jgit.transport.resolver.ReceivePackFactory, .UploadPackFactory, org.eclipse.jgit.util.FS, org.eclipse.jgit.util.io.MessageWriter, .StreamCopyThread

Transport to access a local directory as though it were a remote peer.

This transport is suitable for use on the local system, where the caller has direct read or write access to the "remote" repository.

By default this transport works by spawning a helper thread within the same JVM, and processes the data transfer using a shared memory buffer between the calling thread and the helper thread. This is a pure-Java implementation which does not require forking an external process.

However, during openFetch(), if the Transport has configured Transport#getOptionUploadPack() to be anything other than "git-upload-pack" or "git upload-pack", this implementation will fork and execute the external process, using an operating system pipe to transfer data.

Similarly, during openPush(), if the Transport has configured Transport#getOptionReceivePack() to be anything other than "git-receive-pack" or "git receive-pack", this implementation will fork and execute the external process, using an operating system pipe to transfer data.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv static final TransportProtocol
private final File
Inherited from org.eclipse.jgit.transport.Transport:
DEFAULT_FETCH_THINDEFAULT_PUSH_THINDEFAULT_PUSH_USE_BITMAPSlocalprotocolREFSPEC_PUSH_ALLREFSPEC_TAGSuri

Constructor Summary

AccessConstructor and Description
pack-priv
TransportLocal(Repository local, URIish uri, File gitDir)

pack-priv
TransportLocal(URIish uri, File gitDir)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract org.eclipse.jgit.transport.Transport.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

pack-priv ReceivePack
pack-priv UploadPack
public FetchConnection
openFetch()

Implements abstract org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

public FetchConnection
openFetch(Collection<RefSpec> refSpecs, String...
that will be set as ref prefixes if the server supports git protocol V2; null values are ignored
additionalPatterns
)

Overrides org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

public PushConnection
openPush()

Implements abstract org.eclipse.jgit.transport.Transport.openPush.

Begins a new connection for pushing into the remote repository.

private Repository
protected Process

Returns:

a java.lang.Process object.
spawn
(String
command
cmd
)

Spawn process

private Process

Returns:

a java.lang.Process object.
spawn
(String
command
cmd
,
TransferConfig.ProtocolVersion
to use
protocolVersion
)

Spawn process

Inherited from org.eclipse.jgit.transport.Transport:
applyConfigfetchfetchfindRemoteRefUpdatesForfindRemoteRefUpdatesForfindRemoteRefUpdatesForfindRemoteRefUpdatesForfindTrackingRefNamegetCredentialsProvidergetDeepenNotsgetDeepenSincegetDepthgetFilterSpecgetObjectCheckergetOptionReceivePackgetOptionUploadPackgetPackConfiggetPushOptionsgetTagOptgetTimeoutgetTransportProtocolsgetURIisCheckFetchedObjectsisDryRunisFetchThinisPushAtomicisPushThinisPushUseBitmapsisRemoveDeletedRefsopenopenopenopenopenopenopenopenAllopenAllopenAllopenAllpushpushregistersetCheckFetchedObjectssetCredentialsProvidersetDeepenNotssetDeepenSincesetDepthsetDepthsetDryRunsetFetchThinsetFilterSpecsetHookErrorStreamsetHookOutputStreamsetObjectCheckersetOptionReceivePacksetOptionUploadPacksetPackConfigsetPushAtomicsetPushOptionssetPushThinsetPushUseBitmapssetRemoveDeletedRefssetTagOptsetTimeoutunregister

Field Detail

PROTO_LOCALback to summary
pack-priv static final TransportProtocol PROTO_LOCAL
remoteGitDirback to summary
private final File remoteGitDir

Constructor Detail

TransportLocalback to summary
pack-priv TransportLocal(Repository local, URIish uri, File gitDir)
TransportLocalback to summary
pack-priv TransportLocal(URIish uri, File gitDir)

Method Detail

closeback to summary
public void close()

Implements abstract org.eclipse.jgit.transport.Transport.close.

Implements java.lang.AutoCloseable.close.

Doc from org.eclipse.jgit.transport.Transport.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Close any resources used by this transport.

If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

AutoClosable.close() declares that it throws Exception. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.

Annotations
@Override
createReceivePackback to summary
pack-priv ReceivePack createReceivePack(Repository dst)
createUploadPackback to summary
pack-priv UploadPack createUploadPack(Repository dst)
openFetchback to summary
public FetchConnection openFetch() throws TransportException

Implements abstract org.eclipse.jgit.transport.Transport.openFetch.

Doc from org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

If the transport has no local repository, the fetch connection can only be used for reading remote refs.

Returns:FetchConnection

a fresh connection to fetch from the remote repository.

Annotations
@Override
Exceptions
TransportException:
the remote connection could not be established.
openFetchback to summary
public FetchConnection openFetch(Collection<RefSpec> refSpecs, String... additionalPatterns) throws TransportException

Overrides org.eclipse.jgit.transport.Transport.openFetch.

Doc from org.eclipse.jgit.transport.Transport.openFetch.

Begins a new connection for fetching from the remote repository.

If the transport has no local repository, the fetch connection can only be used for reading remote refs.

If the server supports git protocol V2, the RefSpecs and the additional patterns, if any, are used to restrict the server's ref advertisement to matching refs only.

Transports that want to support git protocol V2 must override this; the default implementation ignores its arguments and calls openFetch().

Parameters
refSpecs:Collection<RefSpec>

that will be fetched via FetchConnection#fetch(ProgressMonitor, Collection, java.util.Set, OutputStream) later

additionalPatterns:String[]

that will be set as ref prefixes if the server supports git protocol V2; null values are ignored

Returns:FetchConnection

a fresh connection to fetch from the remote repository.

Annotations
@Override
Exceptions
TransportException:
the remote connection could not be established.
openPushback to summary
public PushConnection openPush() throws TransportException

Implements abstract org.eclipse.jgit.transport.Transport.openPush.

Doc from org.eclipse.jgit.transport.Transport.openPush.

Begins a new connection for pushing into the remote repository.

Returns:PushConnection

a fresh connection to push into the remote repository.

Annotations
@Override
Exceptions
TransportException:
the remote connection could not be established
openRepoback to summary
private Repository openRepo() throws TransportException
spawnback to summary
protected Process spawn(String cmd) throws TransportException

Spawn process

Parameters
cmd:String

command

Returns:Process

a java.lang.Process object.

Exceptions
TransportException:
if any.
spawnback to summary
private Process spawn(String cmd, TransferConfig.ProtocolVersion protocolVersion) throws TransportException

Spawn process

Parameters
cmd:String

command

protocolVersion:TransferConfig.ProtocolVersion

to use

Returns:Process

a java.lang.Process object.

Exceptions
TransportException:
if any.
org.eclipse.jgit.transport back to summary

pack-priv Class TransportLocal.ForkLocalFetchConnection

extends BasePackFetchConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Thread
private Process
Inherited from org.eclipse.jgit.transport.BasePackFetchConnection:
ADVERTISEDCOMMONMIN_CLIENT_BUFFEROPTION_ALLOW_REACHABLE_SHA1_IN_WANTOPTION_ALLOW_TIP_SHA1_IN_WANTOPTION_FILTEROPTION_INCLUDE_TAGOPTION_MULTI_ACKOPTION_MULTI_ACK_DETAILEDOPTION_NO_DONEOPTION_NO_PROGRESSOPTION_OFS_DELTAOPTION_SHALLOWOPTION_SIDE_BANDOPTION_SIDE_BAND_64KOPTION_THIN_PACKREACHABLE

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
ForkLocalFetchConnection(Collection<RefSpec> refSpecs, String... additionalPatterns)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.eclipse.jgit.transport.BasePackFetchConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources.

Inherited from org.eclipse.jgit.transport.BasePackFetchConnection:
didFetchIncludeTagsdidFetchTestConnectivitydoFetchfetchfetchgetFetchConfiggetPackLocksonReceivePacksetPackLockMessage

Field Detail

errorReaderThreadback to summary
private Thread errorReaderThread
uploadPackback to summary
private Process uploadPack

Constructor Detail

ForkLocalFetchConnectionback to summary
pack-priv ForkLocalFetchConnection() throws TransportException
ForkLocalFetchConnectionback to summary
pack-priv ForkLocalFetchConnection(Collection<RefSpec> refSpecs, String... additionalPatterns) throws TransportException

Method Detail

closeback to summary
public void close()

Overrides org.eclipse.jgit.transport.BasePackFetchConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Doc from org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Close any resources used by this connection.

If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

If additional messages were produced by the remote peer, these should still be retained in the connection instance for getMessages().

AutoClosable.close() declares that it throws Exception. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.

Annotations
@Override
org.eclipse.jgit.transport back to summary

pack-priv Class TransportLocal.ForkLocalPushConnection

extends BasePackPushConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Thread
private Process
Inherited from org.eclipse.jgit.transport.BasePackPushConnection:
CAPABILITY_DELETE_REFSCAPABILITY_OFS_DELTACAPABILITY_PUSH_OPTIONSCAPABILITY_REPORT_STATUSCAPABILITY_SIDE_BAND_64K

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.eclipse.jgit.transport.BasePackConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources.

Inherited from org.eclipse.jgit.transport.BasePackPushConnection:
doPushgetPushOptionsisUseBitmapsnoRepositorypushpush

Field Detail

errorReaderThreadback to summary
private Thread errorReaderThread
receivePackback to summary
private Process receivePack

Constructor Detail

ForkLocalPushConnectionback to summary
pack-priv ForkLocalPushConnection() throws TransportException

Method Detail

closeback to summary
public void close()

Overrides org.eclipse.jgit.transport.BasePackConnection.close.

Implements org.eclipse.jgit.transport.Connection.close.

Doc from org.eclipse.jgit.transport.Connection.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Close any resources used by this connection.

If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

If additional messages were produced by the remote peer, these should still be retained in the connection instance for getMessages().

AutoClosable.close() declares that it throws Exception. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.

Annotations
@Override