Package org.eclipse.jgit.api
Class ListBranchCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<java.util.List<Ref>>
-
- org.eclipse.jgit.api.ListBranchCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<java.util.List<Ref>>
public class ListBranchCommand extends GitCommand<java.util.List<Ref>>
Used to obtain a list of branches.In case HEAD is detached (it points directly to a commit), it is also returned in the results.
- See Also:
- Git documentation about Branch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ListBranchCommand.ListMode
The modes available for listing branches (corresponding to the -r and -a options)
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
containsCommitish
private ListBranchCommand.ListMode
listMode
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ListBranchCommand(Repository repo)
Constructor for ListBranchCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Ref>
call()
private java.util.Collection<Ref>
filterRefs(java.util.Collection<Ref> refs)
ListBranchCommand
setContains(java.lang.String containsCommitish)
If this is set, only the branches that contain the specified commit-ish as an ancestor are returned.ListBranchCommand
setListMode(ListBranchCommand.ListMode listMode)
Set the list mode-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Field Detail
-
listMode
private ListBranchCommand.ListMode listMode
-
containsCommitish
private java.lang.String containsCommitish
-
-
Constructor Detail
-
ListBranchCommand
protected ListBranchCommand(Repository repo)
Constructor for ListBranchCommand.- Parameters:
repo
- aRepository
object.
-
-
Method Detail
-
call
public java.util.List<Ref> call() throws GitAPIException
Execute the command
- Specified by:
call
in interfacejava.util.concurrent.Callable<java.util.List<Ref>>
- Specified by:
call
in classGitCommand<java.util.List<Ref>>
- Throws:
GitAPIException
-
filterRefs
private java.util.Collection<Ref> filterRefs(java.util.Collection<Ref> refs) throws RefNotFoundException, java.io.IOException
- Throws:
RefNotFoundException
java.io.IOException
-
setListMode
public ListBranchCommand setListMode(ListBranchCommand.ListMode listMode)
Set the list mode- Parameters:
listMode
- optional: corresponds to the -r/-a options; by default, only local branches will be listed- Returns:
- this instance
-
setContains
public ListBranchCommand setContains(java.lang.String containsCommitish)
If this is set, only the branches that contain the specified commit-ish as an ancestor are returned.- Parameters:
containsCommitish
- a commit ID or ref name- Returns:
- this instance
- Since:
- 3.4
-
-