Package org.eclipse.jgit.api
Class LsRemoteCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<T>
org.eclipse.jgit.api.TransportCommand<LsRemoteCommand,Collection<Ref>>
org.eclipse.jgit.api.LsRemoteCommand
- All Implemented Interfaces:
Callable<Collection<Ref>>
The ls-remote command
- See Also:
-
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.TransportCommand
credentialsProvider, timeout, transportConfigCallback
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall()
Same ascall()
, but return Map instead of Collection.execute()
setHeads
(boolean heads) Include refs/heads in references resultsThe remote (uri or name) used for the fetch operation.setTags
(boolean tags) Include refs/tags in references resultssetUploadPack
(String uploadPack) The full path of git-upload-pack on the remote hostMethods inherited from class org.eclipse.jgit.api.TransportCommand
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
remote
-
heads
private boolean heads -
tags
private boolean tags -
uploadPack
-
-
Constructor Details
-
LsRemoteCommand
Constructor for LsRemoteCommand- Parameters:
repo
- local repository or null for operation without local repository
-
-
Method Details
-
setRemote
The remote (uri or name) used for the fetch operation. If no remote is set, the default value ofConstants.DEFAULT_REMOTE_NAME
will be used.- Parameters:
remote
- aString
object.- Returns:
this
- See Also:
-
setHeads
Include refs/heads in references results- Parameters:
heads
- whether to include refs/heads- Returns:
this
-
setTags
Include refs/tags in references results- Parameters:
tags
- whether to include tags- Returns:
this
-
setUploadPack
The full path of git-upload-pack on the remote host- Parameters:
uploadPack
- the full path of executable providing the git-upload-pack service on remote host- Returns:
this
-
call
Execute the command
Execute the
LsRemote
command with all the options and parameters collected by the setter methods (e.g.setHeads(boolean)
) of this class. Each instance of this class should only be used for one invocation of the command. Don't call this method twice on an instance.- Specified by:
call
in interfaceCallable<Collection<Ref>>
- Specified by:
call
in classGitCommand<Collection<Ref>>
- Throws:
GitAPIException
InvalidRemoteException
TransportException
-
callAsMap
public Map<String,Ref> callAsMap() throws GitAPIException, InvalidRemoteException, TransportExceptionSame ascall()
, but return Map instead of Collection.- Returns:
- a map from names to references in the remote repository
- Throws:
GitAPIException
- or subclass thereof when an error occursInvalidRemoteException
- when called with an invalid remote uriTransportException
- for errors that occurs during transport- Since:
- 3.5
-
execute
private Map<String,Ref> execute() throws GitAPIException, InvalidRemoteException, TransportException
-