Package org.eclipse.jgit.api
Class ListBranchCommand
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The modes available for listing branches (corresponding to the -r and -a options) -
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ListBranchCommand
(Repository repo) Constructor for ListBranchCommand. -
Method Summary
Modifier and TypeMethodDescriptioncall()
private Collection
<Ref> filterRefs
(Collection<Ref> refs) setContains
(String containsCommitish) If this is set, only the branches that contain the specified commit-ish as an ancestor are returned.setListMode
(ListBranchCommand.ListMode listMode) Set the list modeMethods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
listMode
-
containsCommitish
-
-
Constructor Details
-
ListBranchCommand
Constructor for ListBranchCommand.- Parameters:
repo
- aRepository
object.
-
-
Method Details
-
call
Execute the command
- Specified by:
call
in interfaceCallable<List<Ref>>
- Specified by:
call
in classGitCommand<List<Ref>>
- Throws:
GitAPIException
-
filterRefs
- Throws:
RefNotFoundException
IOException
-
setListMode
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
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
-