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>>
public class LsRemoteCommand extends TransportCommand<LsRemoteCommand,Collection<Ref>>
The ls-remote command- See Also:
- Git documentation about ls-remote
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.TransportCommand
credentialsProvider, timeout, transportConfigCallback
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description LsRemoteCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Ref>call()Executes theLsRemotecommand with all the options and parameters collected by the setter methods (e.g.Map<String,Ref>callAsMap()Same ascall(), but return Map instead of Collection.LsRemoteCommandsetHeads(boolean heads)Include refs/heads in references resultsLsRemoteCommandsetRemote(String remote)The remote (uri or name) used for the fetch operation.LsRemoteCommandsetTags(boolean tags)Include refs/tags in references resultsLsRemoteCommandsetUploadPack(String uploadPack)The full path of git-upload-pack on the remote host-
Methods 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
-
-
-
-
Constructor Detail
-
LsRemoteCommand
public LsRemoteCommand(Repository repo)
- Parameters:
repo- local repository or null for operation without local repository
-
-
Method Detail
-
setRemote
public LsRemoteCommand setRemote(String remote)
The remote (uri or name) used for the fetch operation. If no remote is set, the default value ofConstants.DEFAULT_REMOTE_NAMEwill be used.- Parameters:
remote-- Returns:
this- See Also:
Constants.DEFAULT_REMOTE_NAME
-
setHeads
public LsRemoteCommand setHeads(boolean heads)
Include refs/heads in references results- Parameters:
heads-- Returns:
this
-
setTags
public LsRemoteCommand setTags(boolean tags)
Include refs/tags in references results- Parameters:
tags-- Returns:
this
-
setUploadPack
public LsRemoteCommand setUploadPack(String uploadPack)
The full path of git-upload-pack on the remote host- Parameters:
uploadPack-- Returns:
this
-
call
public Collection<Ref> call() throws GitAPIException, InvalidRemoteException, TransportException
Executes theLsRemotecommand 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:
callin interfaceCallable<Collection<Ref>>- Specified by:
callin classGitCommand<Collection<Ref>>- Returns:
- a collection of 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
-
callAsMap
public Map<String,Ref> callAsMap() throws GitAPIException, InvalidRemoteException, TransportException
Same 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
-
-