A transport can be used for either fetching (copying objects into the caller's repository from the remote repository) or pushing (copying objects into the remote repository from the caller's repository). Each transport implementation is responsible for the details associated with establishing the network connection(s) necessary for the copy, as well as actually shuffling data back and forth.
Transport instances and the connections they create are not thread-safe. Callers must ensure a transport is accessed by only one thread at a time.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | Transport.
Type of operation a Transport is being opened for. |
| Modifier and Type | Field and Description |
|---|---|
| private CredentialsProvider | credentialsProvider
Assists with authentication the connection. |
| private List | |
| private Instant | |
| public static final boolean | DEFAULT_FETCH_THIN
Default setting for |
| public static final boolean | DEFAULT_PUSH_THIN
Default setting for |
| public static final boolean | DEFAULT_PUSH_USE_BITMAPS
Default setting for |
| private Integer | |
| private boolean | dryRun
Should push just check for operation result, not really push. |
| private List | fetch
Specifications to apply during fetch. |
| private boolean | fetchThin
Should fetch request thin-pack if remote repository can produce it. |
| private FilterSpec | |
| private PrintStream | |
| private PrintStream | |
| protected final Repository | local
The repository this transport fetches into, or pushes out of. |
| private ObjectChecker | objectChecker
Should an incoming (fetch) transfer validate objects? |
| private String | optionReceivePack
Name of the receive pack program, if it must be executed. |
| private String | optionUploadPack
Name of the upload pack program, if it must be executed. |
| private PackConfig | packConfig
Pack configuration used by this transport to make pack file. |
| pack-priv TransferConfig. | |
| private static final List | |
| private List | push
Specifications to apply during push. |
| private boolean | pushAtomic
Should push be all-or-nothing atomic behavior? |
| private List | pushOptions
The option strings associated with the push operation. |
| private boolean | pushThin
Should push produce thin-pack when sending objects to remote repository. |
| private boolean | pushUseBitmaps
Should push use bitmaps? |
| public static final RefSpec | REFSPEC_PUSH_ALL
Specification for push operation, to push all refs under refs/heads. |
| public static final RefSpec | REFSPEC_TAGS
Specification for fetch or push operations, to fetch or push all tags. |
| private String | |
| private boolean | removeDeletedRefs
Should refs no longer on the source be pruned from the destination? |
| private TagOpt | tagopt
How |
| private int | timeout
Timeout in seconds to wait before aborting an IO read or write. |
| protected final URIish | uri
The URI used to create this transport. |
| Access | Constructor and Description |
|---|---|
| protected | Transport(Repository
the repository this instance will fetch into, or push out of.
This must be the repository passed to
local, URIish open(Repository, URIish).the URI used to access the remote repository. This must be the
URI passed to uri)open(Repository, URIish).Create a new transport instance. |
| protected | Transport(URIish
a uri)org. object.Create a minimal transport instance not tied to a single repository. |
| Modifier and Type | Method and Description |
|---|---|
| public void | applyConfig(RemoteConfig
configuration to apply on this transport. cfg)Apply provided remote configuration on this transport. |
| private static Enumeration | |
| public abstract void | close()
Redeclares java. Closes this resource, relinquishing any underlying resources. |
| private static boolean | |
| private static Collection | |
| public FetchResult | Returns: information describing the tracking refs updated.progress monitor to inform the user about our processing
activity. Must not be null. Use
monitor, Collection<RefSpec> org. if progress
updates are not interesting or necessary.specification of refs to fetch locally. May be null or the
empty collection to use the specifications from the
RemoteConfig. May contains regular and negative
toFetch)RefSpecs. Source for each regular RefSpec can't
be null.Fetch objects and refs from the remote repository to the local one. |
| public FetchResult | Returns: information describing the tracking refs updated.progress monitor to inform the user about our processing
activity. Must not be null. Use
monitor, Collection<RefSpec> org. if progress
updates are not interesting or necessary.specification of refs to fetch locally. May be null or the
empty collection to use the specifications from the
RemoteConfig. May contain regular and negative
toFetch, String RefSpecs. Source for each regular RefSpec can't
be null.the initial branch to check out when cloning the repository.
Can be specified as ref name ( branch)refs/heads/master),
branch name (master) or tag name
(v1.2.3). The default is to use the branch
pointed to by the cloned repository's HEAD and can be
requested by passing null or HEAD.Fetch objects and refs from the remote repository to the local one. |
| public static Collection | Returns: collection of set uporg..local database. db, final Collection<RefSpec> collection of RefSpec to convert. specs, final Map<String, RefLeaseSpec> map from ref to lease (containing expected old object id) leases, Collection<RefSpec> fetch specifications used for finding localtracking refs. May
be null or empty collection. fetchSpecs)Convert push remote refs update specification from
|
| public static Collection | Returns: collection of set uporg..local database. db, final Collection<RefSpec> collection of RefSpec to convert. specs, Collection<RefSpec> fetch specifications used for finding localtracking refs. May
be null or empty collection. fetchSpecs)Convert push remote refs update specification from
|
| public Collection | Returns: collection of set uporg..collection of RefSpec to convert. specs)Convert push remote refs update specification from
|
| public Collection | Returns: collection of set uporg..collection of RefSpec to convert. specs, final Map<String, RefLeaseSpec> map from ref to lease (containing expected old object id) leases)Convert push remote refs update specification from
|
| pack-priv static String | |
| public CredentialsProvider | Returns: the credentials provider, or null if no credentials provider is associated with this transport.The configured credentials provider. |
| public final List | |
| public final Instant | |
| public final Integer | |
| public final FilterSpec | Returns: the last filter spec set withsetFilterSpec(FilterSpec),
or FilterSpec#NO_FILTER if it was never invoked.Get filter spec |
| public ObjectChecker | Returns: configured object checker for received objects, or null.Get configured object checker for received objects |
| public String | Returns: remote executable providing receive-pack service for pack transports.Default setting is:
|
| public String | Returns: typically "git-upload-pack".Get the name of the remote executable providing upload-pack service. |
| public PackConfig | Returns: the pack configuration. Never null.Get the configuration used by the pack generator to make packs. |
| public List | Returns: the option strings associated with the push operationGet the option strings associated with the push operation |
| public TagOpt | Returns: option indicating the behavior of annotated tags in fetch.Get the description of how annotated tags should be treated during fetch. |
| public int | Returns: timeout (in seconds) before aborting an IO operation.Get timeout (in seconds) before aborting an IO operation. |
| public static List | Returns: an immutable copy of the currently registered protocols.Obtain a copy of the registered protocols. |
| public URIish | Returns: the URI describing the location of the remote repository.Get the URI this transport connects to. |
| private static List | |
| public boolean | Returns: true if fetch will verify received objects are formatted correctly. Validating objects requires more CPU time on the client side of the connection.Whether fetch will verify if received objects are formatted correctly. |
| public boolean | Returns: true if push operation should just check for possible result and not really update remote refs, false otherwise - when push should act normally.Whether push operation should just check for possible result and not really update remote refs |
| public boolean | Returns: true if fetch should request thin-pack when possible; false otherwiseDefault setting is: |
| public boolean | Returns: true if push requires all-or-nothing atomic behavior.Default setting is false. |
| public boolean | Returns: true if push should produce thin-pack in pack transportsDefault setting is: false |
| public boolean | |
| public boolean | Returns: true if destination refs should be removed if they no longer exist at the source repository.Whether destination refs should be removed if they no longer exist at the source repository. |
| private static void | |
| public static Transport | Returns: the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen.existing local repository. local, String location of the remote repository - may be URI or remote
configuration name. remote)Open a new transport instance to connect two repositories. |
| public static Transport | Returns: the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen.existing local repository. local, final String location of the remote repository - may be URI or remote
configuration name. remote, final Transport.planned use of the returned Transport; the URI may differ
based on the type of connection desired. opOpen a new transport instance to connect two repositories. |
| public static Transport | Returns: the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen.existing local repository. local, RemoteConfig configuration describing how to connect to the remote
repository. cfg)Open a new transport instance to connect two repositories. |
| public static Transport | Returns: the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen.existing local repository. local, final RemoteConfig configuration describing how to connect to the remote
repository. cfg, final Transport.planned use of the returned Transport; the URI may differ
based on the type of connection desired. opOpen a new transport instance to connect two repositories. |
| public static Transport | Returns: the new transport instance. Never null.existing local repository. local, URIish location of the remote repository. uri)Open a new transport instance to connect two repositories. |
| public static Transport | Returns: the new transport instance. Never null.existing local repository. local, URIish location of the remote repository. uri, String name of the remote, if the remote as configured in
remoteName)local; otherwise null.Open a new transport instance to connect two repositories. |
| public static Transport | Returns: new Transport instancea uri)org. object.Open a new transport with no local repository. |
| public static List | Returns: the list of new transport instances for every URI in remote configuration.existing local repository. local, final String location of the remote repository - may be URI or remote
configuration name. remote)Open new transport instances to connect two repositories. |
| public static List | Returns: the list of new transport instances for every URI in remote configuration.existing local repository. local, final String location of the remote repository - may be URI or remote
configuration name. remote, final Transport.planned use of the returned Transport; the URI may differ
based on the type of connection desired. opOpen new transport instances to connect two repositories. |
| public static List | Returns: the list of new transport instances for every URI in remote configuration.existing local repository. local, final RemoteConfig configuration describing how to connect to the remote
repository. cfg)Open new transport instances to connect two repositories. |
| public static List | Returns: the list of new transport instances for every URI in remote configuration.existing local repository. local, final RemoteConfig configuration describing how to connect to the remote
repository. cfg, final Transport.planned use of the returned Transport; the URI may differ
based on the type of connection desired. opOpen new transport instances to connect two repositories. |
| public abstract FetchConnection | Returns: a fresh connection to fetch from the remote repository.Begins a new connection for fetching from the remote repository. |
| public FetchConnection | Returns: a fresh connection to fetch from the remote repository.that will be fetched via
refSpecs, String... FetchConnection#fetch(ProgressMonitor, Collection, java. laterthat will be set as ref prefixes if the server supports git
protocol V2; additionalPatterns)null values are ignoredBegins a new connection for fetching from the remote repository. |
| public abstract PushConnection | Returns: a fresh connection to push into the remote repository.Begins a new connection for pushing into the remote repository. |
| public PushResult | Returns: information about results of remote refs updates, tracking refs updates and refs advertised by remote repository.progress monitor to inform the user about our processing
activity. Must not be null. Use
monitor, Collection<RemoteRefUpdate> org. if progress
updates are not interesting or necessary.specification of refs to push. May be null or the empty
collection to use the specifications from the RemoteConfig
converted by toPush, OutputStream findRemoteRefUpdatesFor(Collection). No
more than 1 RemoteRefUpdate with the same remoteName is
allowed. These objects are modified during this call.output stream to write messages to out)Push objects and refs from the local repository to the remote one. |
| public PushResult | Returns: information about results of remote refs updates, tracking refs updates and refs advertised by remote repository.progress monitor to inform the user about our processing
activity. Must not be null. Use
monitor, Collection<RemoteRefUpdate> org. if progress
updates are not interesting or necessary.specification of refs to push. May be null or the empty
collection to use the specifications from the RemoteConfig
converted by toPush)findRemoteRefUpdatesFor(Collection). No
more than 1 RemoteRefUpdate with the same remoteName is
allowed. These objects are modified during this call.Push objects and refs from the local repository to the remote one. |
| public static void | register(TransportProtocol
the protocol definition. Must not be null. proto)Register a TransportProtocol instance for use during open. |
| private static void | |
| private static void | |
| public void | setCheckFetchedObjects(boolean
true to enable checking received objects; false to assume all
received objects are valid. check)Configure if checking received objects is enabled |
| public void | setCredentialsProvider(CredentialsProvider
the credentials provider, or null if there is none credentialsProvider)A credentials provider to assist with authentication connections.. |
| public final void | setDeepenNots(List<String>
the deepen-not. Must not be deepenNots)nullDeepen or shorten the history of a shallow repository to exclude commits reachable from a specified remote branch or tag. |
| public final void | setDeepenSince(Instant
the deepen-since. Must not be deepenSince)nullDeepen or shorten the history of a shallow repository to include all reachable commits after a specified time. |
| public final void | setDepth(int
the depth depth)Limits fetching to the specified number of commits from the tip of each remote branch history. |
| public final void | |
| public void | setDryRun(boolean
true if push operation should just check for possible result
and not really update remote refs, false otherwise - when push
should act normally. dryRun)Set dry run option for push operation. |
| public void | setFetchThin(boolean
true when fetch should request thin-pack when possible; false
when it shouldn't fetchThin)Set the thin-pack preference for fetch operation. |
| public final void | |
| public void | |
| public void | |
| public void | setObjectChecker(ObjectChecker
if non-null the object checking instance to verify each
received object with; null to disable object checking. impl)Set the object checker to verify each received object with |
| public void | setOptionReceivePack(String
remote executable, if null or empty default one is set; optionReceivePack)Set remote executable providing receive-pack service for pack transports. |
| public void | setOptionUploadPack(String
name of the executable. where)Set the name of the remote executable providing upload-pack services. |
| public void | setPackConfig(PackConfig
configuration controlling packing parameters. If null the
source repository's settings will be used. pc)Set the configuration used by the pack generator. |
| public void | setPushAtomic(boolean
true when push should be an all-or-nothing operation. atomic)Request atomic push (all references succeed, or none do). |
| public void | setPushOptions(List<String>
null if push options are unsupported pushOptions)Sets the option strings associated with the push operation. |
| public void | setPushThin(boolean
true when push should produce thin-pack in pack transports;
false when it shouldn't pushThin)Set thin-pack preference for push operation. |
| public void | setPushUseBitmaps(boolean
false to disable use of bitmaps for push, true otherwise. useBitmaps)Set whether to use bitmaps for push. |
| public void | setRemoveDeletedRefs(boolean
true to remove refs that no longer exist. remove)Set whether or not to remove refs which no longer exist in the source. |
| public void | |
| public void | setTimeout(int
number of seconds to wait (with no data transfer occurring)
before aborting an IO read or write operation with this
remote. seconds)Set the timeout before willing to abort an IO call. |
| public static void | unregister(TransportProtocol
the exact object previously given to register. proto)Unregister a TransportProtocol instance. |